Thursday, 5 March 2015

How To Run A Java Program



  • First of all prepare source code file. I have one HelloPro.java file.
  • Open cmd Command. There is 2 way to open command prompt:-
    • First way:- Press WINDOW+R and type cmd then press ENTER.
    • Second way:- Press WINDOW key and type cmd in search box finnaly press ENTER.
  • Set your source file path. My source file (HelloPro.java) situated in desktop.

  • Set your java file path. There is 2 way to set path, first temporary and second is permanently. we have to set temporary path:- 

  • Now we have to compile java source file. This process give us .class extention class file.
  • Write:- javac HelloPro.java

  • If there is no any error in your source code compiler give you a HelloPro.java file.
  • Now we have to interpret our class file.
  • Write:- java HelloPro

  • If there is no runtime error then result shown by the interpreter.

Finish!

0 comments:

Post a Comment