How to Set PATH Variable for JDK in Windows


If you’re a Java programmer you’d know what a pain it is to compile the program andrun it. Especially if your working directory is in some other place, than where you have installed JDK. There is a simple workaround for this problem, setting a PATHvariable. So instead of compiling a program with something like C:\Program Files\Java\jdk1.6.0_20\bin\javac MyProgram.java you’d only need to use the command javac MyProgram.java.
[image]java-logo2









Just follow these steps:
  • First right-click on your My Computer icon on your Desktop and click on Properties. Alternatively you could just press the Windows Key+Pause Break Key.
  • Now in the new window that opened, click on the Advanced tab.[image]How to Set PATH Variable for JDK in Windows1
  • Now click on Environment Variables.[image]How to Set PATH Variable for JDK in Windows2
  • In the new Window that opened, click on New.[image]How to Set PATH Variable for JDK in Windows3
  • In the Variable Name field enter PATH and in the Variable Value enter the path of your JDK bin folder. (For eg. C:\Program Files\Java\jdk1.6.0_20\bin)[image]How to Set PATH Variable for JDK in Windows4
  • Now press OK in the window that remains open, you’ll have to do it thrice.
That’s it. Now if you try to compile your program from anywhere else than your JDK\bin directory, you can do so successfully.
0 Comments
Disqus
Fb Comments
Comments :

0 comments:

Post a Comment