How to compile and run java program through command prompt(cmd)?

Steps:

  1) Open any text editor.

      Note:- Text editor like Notepad.

  2) Write your Java code here.

  3) Save it with extension dot java (.java).

       Note:- Remember to save the java file with ClassName.java (HelloWorld.java).

  4) Open the command prompt.

  5) Go to the location where you save the .java file.


  6) For compilation write > javac FileName.java and press enter.

        Note :- javac is compiler, which convert FileName.java into FileName.class.
                   After compilation a .class file is generated (like FirstName.class).


 7) To run it write > java FileName then press enter.

       Note :- java is a application to run java programs.
                  Don't write > java FileName.class






Comments

Popular posts from this blog

Larch Soft Pvt. Ltd. - Best Website & Hosting Provider