Setting PATH and CLASSPATH in Java in Windows7 & XP (How to set PATH variable in Java in Windows7 & XP)

Hi friends, 
Today I will show you how can you set Java path and Class Path on windows 7. 

If you want to see the VIDEO you can go through this link directly to know how to set path and class path in windows 7  , Or you can continue to the post below.....


First I will check if Java is installed on my machine or not, for this press CTRL+R keys .
and type cmd.  Command prompt will open. just type java  there as shown below.



Now as we can see we don't have Java installed on our machine we will install java first.

for this you can download Java from there official website (Donwlaod From Here)   or if you already have setup just install that as shown below




Now as Java is successfully installed we will proceed to set PATH and CLASSPATH, For this go to MY COMPUTER and right click on My computer icon as shown below and select ADVANCE SYSTEM SETTINGS .



Now a new window will open as shown below , in this window select ENVIRONMENT VARIABLES click on it as shown.


Again one new window will open that will contain all the PATH  and CLASSPATH  variables for the system as shown below 


Here you have to select Path as shown in above picture and click on edit. Now we need to copy the path of Java's bin folder to this place. below picture shows where to go for the bin folder.


After copying this path now again we will move back to our Environment Variable window ,
Now we need to paste this path there, So just type a semi colon(;) and paste the above path we copied to that window and press OK as shown below.

Now it will look like this


Finally we are done with setting PATH variable for Java, now we will proceed to set CLASSPATH,
Now again go to Environment variable window and inside CLASS window click on NEW as shown below.



When you will click here, it will open a new window. you need to type CLASS in variable name and Java's lib folder path as shown below.


To get the lib folder path search for this location as shown in below image and copy it.





Now we are done, just copy and paste the following Path and click on OK button and exit from all windows.  Now open command prompt and type Java - verison as shown below, And it will tell you the current Java version installed on your system







I also made a video on HOW CAN WE SET PATH AND CLASS PATH on WINDOWS 8. Please go through below video for more detail




206 comments:

  1. Ghanta.... not working in windows 7

    ReplyDelete
  2. Worked Great, Thank you very much

    ReplyDelete
  3. hi i set the path as you explained . but when i typed javac in cmd prompt it shows me like could not find or load main class com.sun.tools.javac.main.. .now what can i do for further procedure. plz help me out from this issue

    ReplyDelete
  4. Thanx boss its very useful information.....
    again thanx......

    ReplyDelete
  5. Difference between path and classpath in Java
    path is set for use java tool in your java program like java, javac, javap. javac are used for compile the code. and classpath are used for use predefined class in your program for example use scanner class in your program for this you need to set classpath.

    ReplyDelete
  6. It is really a great work and the way in which u r sharing the knowledge is excellent.
    Thanks for helping me to understand basic concepts. As a beginner in java programming your post help me a lot.Thanks for your informative article.java training in chennai | chennai's no.1 java training in chennai

    ReplyDelete

Powered by Blogger.