title: "Could not find the main class" error when running jar exported by Eclipse
body: <p>I have a java project that works perfectly fine when running it from within Eclipse. When I try to export it to either a <code>"JAR file"</code> or <code>"Runnable JAR file"</code> the .jar file is created, but when I double click on it to try to run the program it gives me an error that says </p>
  
  <pre><code>"Could not find the main class: package.MainClassName. Program will exit."
  </code></pre>
  
  <p>As I mentioned, I tried exporting to both JAR options, I specified the correct class that the main method is in, and when I look through the actual files in the <code>.jar</code> file everything seems to be in order -- the manifest looks something like:</p>
  
  <pre><code>Manifest-Version: 1.0
  Main-Class: package.MainClassName
  (blank line)
  </code></pre>
  
  <p>and is in the <code>META-INF</code> folder. There is a folder with my package name, which contains all the .class files, including the class that contains the main method. A few image and text files that I use also appear in the jar file.</p>
  
  <p>The actual program isn't anything too complicated -- it's a simple "snake" game using Swing (plus the code all works when run from inside Eclipse).</p>
  
  <p>Any ideas what is causing this error and how I can fix it? Let me know if there's any other information I should provide.</p>