Wednesday, 11 February 2015

How To Compile And Run .java File

                                                 COMPILE AND EXECUTE

1. Open Command Prompt.(windows+R, type "cmd" and Enter).

2.Change the directory to the folder which contains your .java file.

3.As of mine, it is "C:\Users\sahil paudel\Documents\java".

4. Type "cd C:\Users\sahil paudel\Documents\java", without quotes.

5.Now type javac (your .java filename),  As javac MyFirstProgram.java  Enter.

6.A bytecode class file will be created. Eg: MyFirstProgram.class  

7. Type java (your .class filename). Eg: java MyFirstProgram  Enter.

8.And You compiled and run your java program.

No comments:

Post a Comment