Friday, December 21, 2012

0 How to Compile Java by Command Line(cmd)

1.Run command prompt(cmd) Start->Accessories->cmd.exe.
2.Type your java files directory in cmd.(eg: cd c:\myJavaPro)
3.After this you want to type javac <your file name>.java
if the cmd shows an error like this then we can understand jdk class path is not set in your system.









4.to set class path type  set path=%path%;C:\Program Files\Java\jdk1.5.0_09\bin
or
Right click on computer->properties->
















advanced system settings->











 in advanced tab select Environment variables->


















in system variables select variable named "PATH" then Click EDIT


















 at the end of variable value put a semi colon and paste the jdk class path(eg:c:\program files\java\jdk\bin).









Then repeat step 3

5.It will create a .class file in your java files folder(eg: filename.class).
then type java <class file name> and press enter then the program be executed.

0 comments:

Post a Comment

 

Code Sea Copyright © 2011 - |- Template created by O Pregador - |- Powered by Blogger Templates