问题
I am compiling a simple program
class Test {
public static void main(String[] args) {
System.out.println("Hello");
}
}
I typed in command prompt java Test.java But it did not work
Could not find or load main class Test.java
Im not using any IDE
Where should i place the program file on my computer
Thank you
回答1:
You cannot directly run a java source file. You need to compile it first using javac:
javac Test.java
Then you get a .class file that you can run:
java Test
来源:https://stackoverflow.com/questions/11265630/how-to-run-and-compile-java-program