1. Home >
  2. Apps >
  3. Groups >

how to run a java file using command prompt?

Question asked by Rits rishi in #Java on May 21, 2012
Rits rishi
Rits rishi · May 21, 2012
Rank D2 - MASTER
guys plz tell me the answer... Posted in: #Java
nareshkumar6539
nareshkumar6539 · May 21, 2012
Rank D2 - MASTER
First you need to compile the java program by using the following command
javac filename
for executing below command is used
java classname
if u r java file name Demo.java and classname is Demo
for compiling javac Demo.java
for executing java Demo
Note: before that you need to set class path
kamba giri
kamba giri · May 23, 2012
Rank E1 - BEGINNER
first of all you need to set class path in environment variables
1.goto my computer-> system properties -> advanced system settings -> environment variables.
2. in the environment variables menu in the first box you need to set the path of the java i.e., jdk path
ex:- .;C:\Program Files (x86)\Java\jdk1.6.0\bin;
and then okk..
3. now you can compile and execute the java program as mentioned by nareshkumar..

You must log-in or sign-up to reply to this post.

Click to Log-In or Sign-Up