title: java -jar Error: Could not find or load main class src.Main
body: <p>I've seen many similar questions but I've decided to post mine because users that had posted other questions were not in my exact same conditions. I'm trying to learn more the Java cli and right now I'm trying to execute a simple program contained in a JAR created by me. The source code is composed by a single file called Main.java.</p>
  <p>Root directory structure:</p>
  <pre><code>- src
  --- Main.java
  - META-INF
  --- MANIFEST.mf
  </code></pre>
  <p>Content of Main.java:</p>
  <pre><code>package src;
  
  public class Main {
      public static void main(String[] args) {
          System.out.println(&quot;Hello World!&quot;);
      }
  }
  </code></pre>
  <p>Content of MANIFEST.mf</p>
  <pre><code>Manifest-Version: 1.0
  Main-Class: src.Main
  </code></pre>
  <p>I've compiled the Main class and stored into a directory named <code>classes</code>. Updated directory structure:</p>
  <pre><code>- classes
  --- src
  ------ Main.class
  - src
  --- Main.java
  - META-INF
  --- MANIFEST.mf
  </code></pre>
  <p>Then I've created a JAR file named myJarFile.jar into the root folder and the directory structure inside of the JAR file is the following:</p>
  <pre><code>- classes
  --- src
  ------ Main.class
  - META-INF
  --- MANIFEST.mf
  </code></pre>
  <p>Where the content of MANIFEST.mf is the one provided above. Now, from within the root folder, I tried to issue the command <code>java -jar myJarFile.jar</code> but I got the error:</p>
  <pre><code>Error: Could not find or load main class src.Main
  Caused by: java.lang.ClassNotFoundException: src.Main
  </code></pre>