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
Its really very informative and a brief one. Although people know how to set path of java in xp but most doesnt know in window 7. This tutorial will help people greatly. This is ur first tutorial but u did like the professionals.
ReplyDeleteThis is the only ultimate solution in Windows 7 i think, i tried many but only this one worked. Thanks Qaiser Imam.
ReplyDeleteoffa after doing this i went to cmd and typed cd,,,and javac but it is showing me tht javac is not an external or internal command plz help me
ReplyDeleteThanks for your solution! It really works!!! Thanks again!!!
ReplyDeleteif u are getting "not an internal or external command" then please first install JAVA or JRE
ReplyDeleteIts very helpful to us.
ReplyDeleteThanks
U HAVE EXPLAINED THIS VERY NICELY
ReplyDeleteI APPRECIATE UR WORK
VERY NICE
after doing this i went to cmd and typed cd,,,and javac but it is showing me tht javac is not an external or internal command plz help me
ReplyDeleteThanks! That worked, but in my case I had to use the jre6 folder. I had the same issue as the "anonymous" person above, and what I was omitting to do, is close the cmd window and reopen... Sometimes it's easy to be stuck because of details like that!
ReplyDeletethis is the best solution.it works
ReplyDeleteThanks dear
ReplyDeletethanks Darling
ReplyDeletethanks ....... u had explained very clearly
ReplyDeleteafter this process i went to cmd and typed javac ,its showing javac is not an internal or external cmmand
ReplyDeleteafter this process i went to cmd and typed javac ,its showing javac is not an internal or external command ,what to do plzzzzzz help me
ReplyDeleteafter doing this i went to cmd and typed cd,,,and javac but it is showing me tht javac is not an external or internal command plz help me
ReplyDeleteCheers! Worked like a charm
ReplyDeleteYour info came in handy..
ReplyDeleteCheers!!!
I appreciate u friend. Ur explanation was simple, detailed n straigtforward. I av been struggling with the installation for a long time.
ReplyDeleteThank u for ur assistance.
i had a problem in compiling
ReplyDeleteno need for all this just type the command: set path=%path%;C:\Program Files\Java\jdk1.7.0_01\bin in variable value in user variable.
ReplyDeletevariable name=path
Thank you !! Really saved a lot of time !
ReplyDeleteReally thanks ............... buddy
ReplyDeleteThanks a lot for the information. I have set up path. It is working fine.
ReplyDeletethank you..very much.
ReplyDeletethanks you for your effort. its working. thanks a lot.
ReplyDeleteGayantha Sri Lanka
Thank you so much. Spend about 3 days on this. I was getting fraustrated already.
ReplyDeletethanks a lot
ReplyDeleteThanks for this, a very simple and clear set of instructions.
ReplyDeleteIts Not Working In My computer ...Do Reply..What to Do?
ReplyDeleteis
This comment has been removed by the author.
ReplyDeleteGuys I Followed The Similar Steps...But Still Its Not Working, when I run da command javac on Command Prompt.
ReplyDeletei Have Installed JDK1.7 and My OS is Windows7. Do post Suggestions..
Its So Urgent For Me.
Still not running plz help... javac is not recognized as internal or external command... i have done all steps u said...
ReplyDeletehelp
plzzzzzzzzzzzzzzz
wow what a help site this is awesome thanks for the given very useful snap shots
ReplyDeletethanks again...,
Lovely post...keep rocking...;)
ReplyDeletegreat its working boss thankU
ReplyDeleteStill not running plz help... javac is not recognized as internal or external command... i have done all steps u said... please...
ReplyDeleteHi Friend,
ReplyDeleteit worked. Thankyou a lot!!! After giving all the above mentioned tips for java,javac is worked.
i use a jCreator pro bat when i m trying to run or compile the program its writing invalid path "C:\Program Files\Java\jdk1.5.0\bin" . bt when i am COMPILING same program in command prompt its executing .CAN U PLZZ HELP ME TO GET RID OF MY PROBLEM.
ReplyDeletethank u very very much dear....
ReplyDeleteVery simple, easy to understand yet informative.. Thanks ..
ReplyDeleteTHANKS a LOT....It WOrked.....I had set the path earlier also by set path command ....i had never set the class and Lib path....but thanks to your tutorial its working now.....Can you please elaborate why we have to set the class path....??
ReplyDeleteIf you ARE trying this steps and an error called "javac is not an external or internal command".. Then you need to install java and remember install the latest one..You will get your solution :)
ReplyDelete@priti : You should have to try setting of jcreator :)
ReplyDeleteTheir may be problem of that side!!!
thanks
ReplyDeletethank u so much dear..hop'g more help'g docs like dis frm u...
ReplyDeleteis .; symbols are necessary before the path and classpath?
ReplyDeletethnk ya so much .,it was really simple
ReplyDeleteyes this ; symbols are necessary before the path and class path, because its separates other paths from java path.
ReplyDeleteFor Java 1.5 or old release you have to set path as well as class path. But after java 1.5 you not need not to set class path, only path is enough...
ReplyDeletesuper...easy way...!!
ReplyDeletethank u very much.It's crystal clear!!
ReplyDeleteThanks for the article
ReplyDeleteSet CLASSPATH In Java / java -cp
your welcome!!!
ReplyDeletethanxx .... a lot for this post .. it helped me a lot to solve this problem.. :) :) !!!!
ReplyDeleteThis is the best tutorial for the topic i hv seen till date. Thanks a ton!!
ReplyDeleteThanks a lot :)
ReplyDeleteThnks Alot dear..... :)
ReplyDeleteThank you for a high quality, first-time-user appropriate, very helpful tutorial on how to get past this. So many other sites explain it like as if you should already know, but yours helps even us newbies that don't know.
ReplyDeletethank u...
ReplyDeletei have better than this
ReplyDeleteI am trying to set the path for Java 3d! path is already set for java sdk what to do for java 3d??
ReplyDeletenice statemtens
ReplyDeleteIn my system there is no user variable called "class" in environment variables dialog box.. how to create it.. will u help on this..??
ReplyDeleteGreat work!...really helpful :)
ReplyDeleteI installed java 7.1 v.. nd jre too.. bt im unable to set the path..can any one help me out??
ReplyDeleteThanks for sharing the information. It helped me a lot!! :)
ReplyDeleteOh...god thnx!!!It really worked!!!I'm so glad for this.:)
ReplyDeletethanks a lot buddy it was really helpful i was very much vexed with it
ReplyDeleteThank you very much....very very important your guideline....
ReplyDeleteexcellent approach .i search many things for path and class setting but this was perfect.
ReplyDeleteEasy to do. Thank u buddy
ReplyDeleteThanks a lot man...
ReplyDeleteITS VERY USEFUL THNK YOU VERY MUCH...............
ReplyDeletethat works for sure....
ReplyDeletethank you friend.. sampath from Sri Lanka
thank you very very much.......
ReplyDeleteThank you very much its very good to understand by seeing screen shots of how to set java path
ReplyDeleteITS SUPERB VERY USEFULL TO ME
ReplyDeleteTHANX
Thanks dude ITS nice presentation
ReplyDeletethnkss a lot frm the bottom of my heart... i m alwys cnfused abt this class and path bt u give me the proper giudance thnxx once again
ReplyDeletethnxx a lot...
ReplyDeleteGreat......
ReplyDeletevery nicely explanation!!!!!!!!!!!!!!!!
ReplyDeleteThanks boss,nice explanation...
ReplyDeleteThanks for this,but the only way to work with on my computer is to delete the dot and the semi-colons before both path... Maybe the wrong way. I'll see soon certainly and sorry for the 's'. Bye.
ReplyDeleteThanks a lot its really great . Very usefull information
ReplyDeletethanq so much yaar...........awesome blog
ReplyDeleteIt's not working in window 7 64 bits and 32 bits O.S.
ReplyDeleteNothing helped.
Please suggest your idea behalf of this problem... and send me result at 9179466920.
thank u so much......really great.
ReplyDeleteThanks a lot buddy...it helped and worked for windows 7 ultimate 64 bit....great job by highliting after taking screen shots...thanks for taking so much pain...
ReplyDeleteGood
ReplyDeletethnk you.
ReplyDeleteTHNX BUDDIE....IT HELPS ALOT
ReplyDeleteyeaaaaaaaaaahhhh!!! it works. thanks
ReplyDeleteAwesome post.....very detailed and helpful.
ReplyDeletesuper
ReplyDeletethankz.................its very helpful...
ReplyDeleteGrazie Roberto.
ReplyDeleteThanks - it was really useful. Gr8.
ReplyDeleteIt worked well for me...thanks...
ReplyDeleteThis is the best tutorial for the topic i hv seen till date. Thanks a ton!!
ReplyDeletethank u very much...it worked!!!
ReplyDeleteThnkq....
ReplyDeleteExcellent job....well defined!!!!
ReplyDeleteSUPERBBB
ReplyDeleteThanx man really worked
ReplyDeleteVery simple, easy to understand yet informative.. Thanks
ReplyDeleteThis comment has been removed by the author.
ReplyDeletethnx....
ReplyDeleteIt worked !!! superb Thanx
ReplyDeleteif i run it as java -classpath . classfilename ,its working.... but if i just run it as java classfilename i get the error Exception in thread "main"
ReplyDeletejava.lang.NoClassDefFoundError :classfilename what to do???please reply fast
Pretty work dear
ReplyDeletethanks , need new update like jdk 7
ReplyDeleteReally it is good information,i think it is useful.
ReplyDeletesuper Cool .. what a single shot answer.
ReplyDeleteIt is really very very informative and the way of presentation is very good.
ReplyDeleteThanks! ;)
ReplyDeleteyou are not suppose to create a new path , the existing path already has important "paths" i it.eg most cmd commands are gotten through the path ie System 32.......use edit , then add the path and afterwards add a semicolon. for those who used new notice that you cannot use normal commands on ur cmd window eg (shutdown -s)Try it...
ReplyDeleteThank you. Your article was really helpful.
ReplyDeleteu sir made my day.. :)
ReplyDeleteTnx ,,,,,this post...but i have problem....
ReplyDeleteD:\java>java hello.java
Exception in thread "main" java.lang.NoClassDefFoundError: hello/java
Caused by: java.lang.ClassNotFoundException: hello.java
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: hello.java. Program will exit.
D:\java>
Nice
ReplyDeleteTNX MAN UR DE BEST
ReplyDeletegreat work... thanks...........
ReplyDeleteAWESOME WOOOO!! thanks
ReplyDeleteThanks a ton, JAVA made my day. all is well.. :-)
ReplyDelete-Syed Mohsin Ahmed
thnx dude, after seeing this it helps me alot..............
ReplyDeletethnx dude, after seeing this it helps me alot..............
ReplyDeleteThanks really a great work...
ReplyDeletePlease tell me how to set Environment Variables for java 6 n tomcat 6
ReplyDeleteCLASSPATH
PATH
n CATALINA_HOME
variables...
plz plz plz help me... im very confused
Wonderful Bharat. Thanks a lot for you. You opened the gateway for me.
ReplyDeleteDude... i am unable to run JDBC programs in windows 7... pls help me...
ReplyDeletethank you soo much. now i can do my java programming in a easy manner
ReplyDeletei am scjp cerified but dont know in depth.....thanks linke is awsome..have clicked on adds...as you said~~`
ReplyDeleteThank u..
ReplyDeletewhile compiling it is showing that cannot read java what do you think is the problem plz help me
ReplyDeleteits working
ReplyDeletethanks buddy
Thankyou very much..!!!
ReplyDeleteIt's working now....I'm Soooo Hapyyy..
Sri Lanka
After doing the above, JAVA command should work.
ReplyDeleteJAVAC might not work thought, if you do not have a JDK installed.
This is because your computer does not have the file JAVAC.exe anywhere. Its not about the path, its about the file. Install some JDK and repeat the process.
Thank u...Very easy Explonation..
ReplyDeletegood so nice uneducated people also understand well its very user friendly thanks thanks a lot
ReplyDeleteWhat is the difference between creating a new variable CLASS & setting it Vs. creating a system variables CLASSPATH pointing to C:\Program Files\Java\jre7\lib
ReplyDeleteThanks bro its really help full for me in peak time.
ReplyDeleteJEEVAN
ecentric solutions
Good One!!
ReplyDeletewowwwwww...........thanx frnd..its worked and helpd us a lot...blast..
ReplyDeletethank u very much
ReplyDeleteThat Mr. Bean shit on the side there? Yeah... That's REALLY goddamn annoying.
ReplyDeleteAs another comment point it out, should you edit your existing path instead of creating a new variable path?
ReplyDeleteHere is the step by step tutorial I follow to set PATH for Java in Windows 7 and Windows 8
ReplyDeleteThanks a lot......dear
ReplyDeletethanks a lot!! it really worked
ReplyDeletehoooh thank you so much!
ReplyDeleteyou gave screenshots and it's so relieving <3
Very very thanks to you .It really works for me.
ReplyDeleteThanks a lot......dear
ReplyDeleteThanks a lot :)
ReplyDeleteYou're the hero I needed, but did not deserve. thanks.
ReplyDeleteYou are execellent!!
ReplyDeleteThanks sir,
ReplyDeleteIt is very helpful.
extremely heplful a very hearty thanks..........to bharatsoft
ReplyDeleteit really succeed. Thank you.
ReplyDeleteI need both java 6 and java 7 for 2 different programs. I followed your instructions and set the path for java7 but now the other program keeps comomg up as 7 and I need 6 for the other.
ReplyDeleteyour instructions for setting the path were great and very helpful. I posted your site to the coordinator. But now I need to use java 6, still on my machine for the other one
ReplyDeleteDude. Its really helpful. Thanks a lot
ReplyDeleteThank you, it was easy to follow!
ReplyDeleteThanks u so much it was too good
ReplyDeleteThanks bro.... At last it worked in my Win 7.... thanks.. Thank u very much....
ReplyDeletethnx dude... this is the most informative and "TRULY WORKING" process i came across so far!!
ReplyDeleteThanks buddy, you made a great help!
ReplyDeletethanks very much.....
ReplyDeleteThank u soo much its really very helpfull
ReplyDeletegret......
ReplyDeletethank u
brilliant link to starter ......
ReplyDeleteI want do make class path as
ReplyDeleteC:\test
guys plz help when i am compiling the java program i am getting javac is not reognised as internal or external command .my java version is jdk1.7,my os is windows 7 32 bit .plz help meeeeeeeeeeeeeeeeee its very urgent
ReplyDeletethankqqqq very muchhh sir.. it has helped me a lott..
ReplyDeleteThis is just the kind of information that i had been looking for, i'm already your rss reader now and i would regularly watch out for the new post, once again hats off to you! Thanks a lot once again, Regards, Difference Classpath and Path
ReplyDeletei installed java 7 version .so i saw only jre7 file folder and i created path also but after running java file cmd is displaying javac is not recognised as an internal or external command.plse give me the solution .
ReplyDeletei installed java 7 version .so i saw only jre7 file folder and i created path also but after running java file cmd is displaying javac is not recognised as an internal or external command.plse give me the solution .
ReplyDeleteHi,
ReplyDeleteThanks a LOT for giving a detailed pictorial view of setting Path and Classpath for Java.
It worked for me.
All the Best for your future endeavors.
Thanks and Regards,
Chaitanya
good job ..it will help to beginers
ReplyDeleteThank u very much... It helped me a lot
ReplyDeleteThanx
ReplyDeletethanks for your help with detailed sreen shot
ReplyDeleteThis Page has nothing in it
ReplyDeletecheck out
http://www.ntu.edu.sg/home/ehchua/programming/java/J9c_PackageClasspath.html
thank you
ReplyDeleteTHANK YOU VERY MUCH
ReplyDeletetx very much to u ...expling with images supeb
ReplyDeletei need to set 'path' 'classpath' in cmd i.e,windows7
ReplyDeleteI followed teh instructions step by step, and after all that when I go to CMD and type java-version its says its not recognixed as an internal or external command. Any further instructions on what to do?
ReplyDeleteThank you so much.. Worked wonderful..:)
ReplyDeletetnq u very much
ReplyDeleteSo nice. I'm also thankful to YOU sir.
ReplyDeleteGreat work thanks a lot
ReplyDeletethanks its useful
ReplyDeletethanks Buddy
ReplyDeletethanks Buddy
ReplyDeleteThanks it's working...............:-)
ReplyDeleteThanks it's working...............:-)
ReplyDeleteThanks A lot Nice Way of Description representing it through Diagram Step by Step. Setting the Path and Class path in windows by marking with yellow in nice way. I have read the few posts in your blog. Simple to Nice way of description that any body can easily understand. I favor to that am describing the Setting the Path and Class path of Environmental Variables in Windows 8
ReplyDeleteSome common issues I have seen being faced by beginners is because they start using the IDE from day one.I have written a blog post for this only where I list the most common issues faced with regard to Classpath
ReplyDelete