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