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.

Java Classpath

                       

7-      Click on Environment Variables on next window that appears after clicking Advanced System Setting.

Environment Variable in Windows

8-      Click on New  under system variable on Environment Variables Window

environment-variables

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

new-system-variable

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

setting-classpath

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.

 

 

Dwarika Dhish Mishra

My name is Dwarika Dhish Mishra, its just my name and I am trying to bring the worth of my name in to actions and wants to be the solution not the problem. I believe in spreading knowledge and happiness. More over I am fun loving person and like travelling a lot. By nature I am a tester and a solution maker. I believe in the tag line of http://ted.org “Idea worth spreading” . For the same, I have created this blog to bring more and more learning to tester fraternity through day to day learning in professional and personal life. All contents are the part of my learning and so are available for all..So please spread the contents as much as you can at your end so that it could reach to every needful people in testing fraternity. I am pretty happy that more and more people are showing interest to become the part your Abode QA blog and I think this is good sign for us all because more and more content would be before you to read and to cherish. You may write or call me at my Email id: dwarika1987@gmail.com Cell: 9999978609

You may also like...

14 Responses

  1. lloyd says:

    Thank you it worked

  2. ankita says:

    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.

  3. gaurav says:

    I does not work for window 7…

  4. reema says:

    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

  5. Premkumar Landa says:

    Really this information is helpful to me.
    Thanks to this site members.

  6. Sachin says:

    Thanks for detailed description dude. Its helps for beginner.

  7. Tim says:

    Helpful as a matter of facts.
    Thanks for saving me some time!!!

  8. venkat j says:

    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

  9. BENJAMIN says:

    GOOD!

  10. tomicrow says:

    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

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.