First of all, u need java JDK install in your PC. I m showing the example for jdk1.7.0_07 installed in my PC.
Then you need to set PATH and CLASS to set....
right click on My Computer>>Properties>>Advance System Settings.
in 'Advanced' tab click on 'Environment variable'
now on 'System Variable' window click on new after that a window will opened in which give
variable name = PATH and variable value = C:\Program Files\Java\jdk1.7.0_07\bin
press OK
on "Users Variable" window, Click on new and give the following value..
variable name = CLASS and variable value =C:\Program Files\Java\jdk1.7.0_07\lib
now your PATH and CLASS is ready.... :)
compile and run:-
lets have a Example: (do same with me)
i write this code:
public class Welcome{
public static void main(String[] args){
System.out.println("Welcome To Java!");
}
}
ans saved it as 'Welcome.java' to a folder named jva in D drive....
now open cmd and do the following
D: (enter)
cd\jva (enter)
javac Welcome.java //now your code compiled
java Welcome //run your code......
now you are done.......
d
No comments:
Post a Comment