First you should have installed java in your system ,then open notepad and write this line into your file so that you run your first java program.
now open command line
line 1-> javac HelloWorld.java will compile your program.
line 2-> java HelloWorld will run your program.
and you can see the output HelloWorld in console window.