When I try to type java helloworldapp.class i get this error Error: Could not find or load main class.Code:class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
}
}
Printable View
When I try to type java helloworldapp.class i get this error Error: Could not find or load main class.Code:class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
}
}
When using command line to compile/run Java source code, it must be done as so.
You don't need to type .class after you call the java command.Code:javac (FILENAME).java
java (FILENAME)
I did so that all *. Class files to run with java but still i get this error.
you aren't compiling or running the class file. You're compiling then running a java file.
I know .
Now I have another problem - the command java works but other javac command does not work.
when using javac, you must do it as *.java. so as another example, I would compile my employee system like this.
Code:javac Employee.java
java Employee