Error: Could not find or load main class sample.Main
<p>I tried troubleshooting this problem for about 4 hours. Nothing worked.
I am using Java and Intellij and JavaFX.</p>

<p><strong>What do I want to do?</strong>
I have created a JavaFX programm on Windows.
I want to execute this .jar on my Raspberry Pi.</p>

<p>Whenever I want to execute this jar I get this error in the console: </p>

<blockquote>
  <p>Error: Could not find or load main class sample.Main</p>
</blockquote>

<p>sample is the package and Main is my class with the main method.</p>

<p>The programm works JUST FINE under windows. (In and outside of IntelliJ).</p>

<p><strong>What steps did I already do?</strong></p>

<ol>
<li><p>Java is up-to-date on my pi. java -version returns 1.8. So we are good here.</p></li>
<li><p>I have imported my used libraries (Pi4J) in my project under project-structure -> libraries. &amp; under modules -> dependencies.</p></li>
<li><p>I have defined a new artifact. I set a main Class (sample.Main) &amp; under JavaFX I set the application class to sample.Main (both are given to me by Intellij) I then build the project by going to build -> build artifacts.</p></li>
<li><p>I checked the MANI-FEST under /src/META-INF/MANI-FEST and it indeed has 
Main-Class: sample.Main</p></li>
<li><p>On my pi I went to the direction in which the jar file is. Then I ran: sudo java -jar Keimgeraet.jar which should work just fine. But then I get the error. </p></li>
<li><p>I probably have done more but forgot it already...</p></li>
</ol>

<p><strong>What might work but I don't know how I would to that:</strong> </p>

<p>In other threads people mentioned that my specified paths could be wrong on another computer (in this case the pi)</p>

<p><a href="http://imgur.com/a/sm03h" rel="noreferrer">Here are some pictures</a> [imgur] how everything is set up. Maybe that helps.</p>

<p>I will gladly try any answer! I am not the most experienced with java and the pi but I am not a complete starter.</p>

<p>Sidequestion: How can I include all the libraries in one final jar file?</p>

<p>If you need any more details feel free to ask!</p>