How to set path and classpath variable for java in Windows
Hello friends, In this post I am going to help you learn “How to set path and classpath variable for java in Windows” . Because Selenium WebDriver Using Java binary will always needs Java in classpath to execute your written selenium scripts.
So let’s starts
1- Download recent version of Java SE Development Kit
(You can download java SE
2- Install JDK and by Default Java installs at at this place C:/Program Files(X86)/Java
3- Java folder contain two folder of name jdk1.6.0_20 and jre6
4- Now we will set the classpath and path for java in our windows machine
5- Right Click on My Computer
6- Now click on Advanced System Setting.
7- Click on Environment Variables on next window that appears after clicking Advanced System Setting.
8- Click on New under system variable on Environment Variables Window
9- A new window for New System Variable will open
10- Before Variable Name write path
11- Before variable value type C:/Program Files(x86)/Java/jdk1.6.0_20/bin
12- Click on Ok
13- Now to set classpath again click on New and again New System Variables will appear
14- Enter
Variable name = classpath and Variable Value = C:/Program Files/Javajdk1.6.0_20/lib
15- Now click Ok and again click Ok on Environment Variables
16- Finally we have set path and classpath and now start you java coding best of luck
I think you have learn enough and you would be able to “Set path and classpath variable for Java in Windows”
Note: Now version might be 11 or something but basic steps will remain same.
Thank you it worked
We are so happy that this post really helps you..so keep watching for more posts
the program is compiling bt can’t run giving the error could not find the main class nd a jni error also give exception in thread main..pls tell the soln.
I does not work for window 7…
it does not work,when i write javac then java compiler will run but file does not when i write javac file.java it gives error cannot read file
Really this information is helpful to me.
Thanks to this site members.
Thanks for detailed description dude. Its helps for beginner.
Helpful as a matter of facts.
Thanks for saving me some time!!!
Excellent article i’ve ever seen..Thanks to the author..Good one mate..
Please visit my article on the same! 🙂
http://www.wikitechy.com/view-article/path-classpath-environment-variable-in-java
GOOD!
Wild cards were introduced from Java 6 . Class path entries can contain the basename wildcard character *, which is considered equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR.
java -cp “lib/*” %MAINCLASS%
Where %MAINCLASS% is the class containing your main method.
More on…Path and ClassPath
http://net-informations.com/java/basics/path.htm