You are on page 1of 3

Steps for compiling and running your first java program using the Java Development kit from

Sun Microsystems Step1:


Open the Windows Command prompt and type this command .Here we are opening notepad with the filename Class1.java (Please remember the .java extension)

Step2:
Notepad would ask if you want to create the file. Click on Yes.This would create the file and you can type the code in it

Step3:
Type the following code.All this code does is print Hello World! on the screen.Remember Java is case sensitive

Step4: Compilation
Now Save the file and get back to the command prompt and type the following command as shown.This command would compile Class1.java and produce Class1.class which contains Java byte code which is machine independent.

Step5: Running the program


If you have any errors,you would see them on the screen.Please go back to notepad and correct the errors and resave the file.If you see a blank output after the javac command, it means there were no errors and you are ready to run the program.You could run the program using the command as shown in the screen shot.

You might also like