How to run a java program using command


#1

Using an IDE is good,but running a java prg using a cmd line is better cos it will enable u to understand how the java development kit works. To start with :
Use Note pad to write the java program and save it has a .java i.e Hello.java.Rem Java is case sensitive
-Click on start;
Click on Control Panel;
Click on System;
Click on Advanced tab;
Click on Environmental Variables button;
An Envionmental Variables Box will appear;
Click on the Path line in the lower System variables window so that it is outlined in blue;
Click on the edit button below the lower System variables window;
An Edit System Variable Box will appear;
If the Path line, now in the edit window, does not end in a semi-colon(:wink: add a semi-colon to the end of the line
Type, at the end of the Path line, the address to the Java Development Kit bin, e.g. if it is in a folder named jdk1.6.0_01 and if this is stored in the Program Files Java folder type C:\Program Files\Java\jdk1.6.0_01\bin at the end of the Path line;
For different versions of the Develeopment Kit replace jdk1.6.0_01 with the appropriate folder name;
Click on the OK, set or apply button in the Edit System Variable box;
Click on the OK, set or apply button in the Environmental Variables box;
Click on the OK, set or apply button in the System Properties (Advanced) box;
Open the cmd prompt;type set path = C:\Program Files\Java\jdk1.6.0_01\bin or any jdk version you have.
Next; change to directory where your saved file is in,i.e cd C:\Users\GREATMAN\document\java.For this case my file was saved in a folder java in document.
Finally:To compile ,use javac the file name and extension.After that a class file wud b createdin ur folder.To run the Class file-Type java class file without extension.


#2

\m/ Nice.