How to Set PATH Variable for JDK in Windows


[image]java-logo2If you’re a Java programmer you’d know what a pain it is to compile the program and run 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 PATH variable. 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.

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.

Subscribe / Share

Article by Richie Sajan

Richie is a Computer Engg. student and the founder of techwithric.com. He blogs on softwares, wordpress, web-design, start-ups and random thoughts! He's also a author at Devil's Workshop. Follow him on twitter @richiesajan. . Richie Sajan has written 81 awesome posts. Richie Sajan tagged this post with: , , , Read other articles by Richie Sajan
It's very calm over here, why not leave a comment?

Leave a Reply




Subscribe

Subscribe our RSS Feed to receive new softwares Or Subscribe by Email To receive our Updates directly in your Inbox.




Sponserer

MyFreeHouse
Hostgator
Payloadz