Open a terminal. If you are on Windows, use start->programs->accessories->command prompt.
Enter the following commands:
mkdir java [or some other suitable name for a folder]
cd java
java -version
javac -version
If you get something sensible from the -version commands, then you have your JDK installation set up correctly.
Use a text editor and open a file called helloWorld.java (it should really be HelloWorld, but I am copying your code), and save it in the "java" folder you just created. Copy and paste all the text from Eclipse into that file.
If the first line starts "package", then put // at the very beginning of that line, because you don't want a package name at this stage.
Save the text file again.
Go back to your command line, and write
dir.
You should now see the name of the file you created. Make sure it hasn't got
.txt added to its name. If that happened, go back to Notepad, and "save as" "helloWorld.java", the difference being that you add "" to the name.
Back to the command line. Enter the following commands:
javac helloWorld.java
java helloWorld
You will find similar instructions
here. If anything goes wrong, there is a "common problems" link at the bottom of that page.
This problem shows why we recommend beginners don't try an
IDE. You can get confused about the IDE's instructions, and miss out the Java™. You need to be very careful about the spellings. You will notice the correct spellings for your code in this
thread, only they are in parts, so you can copy and paste earlier postings and put your class together from those. If you are copying from this website, use the "view plain" link, otherwise you get line numbers added, which you don't want.
If you are not using Windows, look for our
FAQ.