I've written the very first program every beginner do : HelloWorld
Here it is :
" public class HelloWorld
public static void main(String args)
System.out.println( "Hello World!" );
I've then compiled it in the command with : javac HelloWorld.java
it worked but then when I try to run it with : java HelloWorld or java HelloWorld.class or java "c:\users\emmav\documents\csi\helloworld.class"
I get the error : impossible to find or load the main class
If anyone can hint me where I did wrong I'd be very thankful !
That should work if the HelloWorld.class file is in the current directory.
Please run the command and copy the contents of the command prompt window:
Click on Icon in upper left corner
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'
Paste here so we can see exactly what was entered and the exact error message.
Also use the dir command to show what was in the current directory.
Error: Could not find or load main class HelloWorld
Seems like your current directory is "C:\Users\emmav" and you are trying to execute in the directory "c:\users\emmav\documents\csi" .
Please make sure to navigate to the proper path where your file exists and then execute the file.
java HelloWorld.class is a wrong way of executing a java file