I'm a beginner in Java and I created this class:
class test
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}
as test.java, and when I compiled it with this cmd:
javac C:\Users\Aimad\Desktop\test.java
and then:
java C:\Users\Aimad\Desktop\test.class
I received this error :
Could not find or load main class C:\Users\Aimad\Desktop\test.class
java -cp . testor use an IDE ;)java -cp C:\Users\Aimad\Desktop testIt's much simpler when you run from the directory where you code is. ;)cd Users\Aimad\Desktopand after that just usejava testthats it.