How To Permanently Set Path Using Environment Variables In Java?

This post is for those java programmers who are just newbies in this language! After installing JDK, next step is to set path in DOS for compiling your first program in Notepad.

Note: I am not telling about Netbeans where you don't need to set any path. 

Before compiling your program written in Notepad, you need to set path every time after opening command prompt. It means path you set in command prompt is not permanently stayed here. Follow these simple steps for permanently set path using environment variables:
  • Go to Java installation's Bin folder in Program files & copy the whole path from address bar. For e.g.C:\Program Files (x86)\Java\jdk1.6.0_03\bin
  • Now go to start> run> Type sysdm.cpl> In System Properties> Go to Advanced tab> Click on Environment Variables placed on right bottom side.
  • In System variables look for "Path".
  • You will see several variable values.
  • Paste the path you copied from address bar followed by ; in variable value as did in screenshot:

    Set Path In Java
  • That's all.
  • From now, you don't need to set path every time before compiling your program.
If you are using Linux, then you don't need to set any path. Simple compile & run your program with javac & java.

Note: For installing Java in ubuntu, check my other post: How To Install Java In Ubuntu?

Sharing is Caring

Related Posts

Next Post »

Thank you for your comment.