I am a beginner and am setting up my java on windows 10 following the instruction of cs61b
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
After I compiled it with javac HelloWorld.java
, I ran java HelloWorld
but it reported an error:
Error: Could not find or load main class HelloWorld
Caused by: java.lang.ClassNotFoundException: HelloWorld
Instead, java HelloWorld.java
works. I wonder how to fix that problem? Thanks!