title: Could not find or load main a class in Java
body: <p>i have the following project structure:</p>
  
  <pre><code>JavaTest
      Main
          Main.java
      Test
          Test.java
  </code></pre>
  
  <p>Main.java:</p>
  
  <pre><code>package Main;
  import Test.*;
  public class Main {
      public static void main(String[] args) {
      }
  }
  </code></pre>
  
  <p>Test.java:</p>
  
  <pre><code>package Test;
  public class Test {
  } 
  </code></pre>
  
  <p>I compile them with the following commands:</p>
  
  <pre><code>D:\Development\Workspace\JavaTest&gt;javac Main\Main.java
  
  D:\Development\Workspace\JavaTest&gt;javac Test\Test.java
  </code></pre>
  
  <p>The class files are put like this:</p>
  
  <pre><code>JavaTest
      Main
          Main.java
          Main.class
      Test
          Test.java
          Test.class
  </code></pre>
  
  <p>I'm trying to run it with the following command:</p>
  
  <pre><code>D:\Development\Workspace\JavaTest&gt;java -cp D:\Development\Workspace\JavaTest\Main;D:\Development\Workspace\JavaTest\Test Main
  </code></pre>
  
  <p>The error i'm getting is:</p>
  
  <pre><code>Error: Could not find or load main class Main
  Caused by: java.lang.NoClassDefFoundError: Main/Main (wrong name: Main)
  </code></pre>