Friday, 4 January 2013

Changing the PATH Environment Variable

Setting up PATH for Java Program


We may have to set the PATH for environment variables for the easier execution of the Java Program. 


We can run the JDK without setting the Environment variable. However, it is easy to compile and run the codes written in java after setting the PATH. If you do not set the PATH variable, you need to specify the full path to the executable file every time you run it. 

Eg: C:\> "C:\Program Files\Java\jdk1.7.0\bin\javac" MyProgram.java

To set the PATH variable permanently, add the full path of the jdk1.7.0\bin directory to the PATH variable. Typically, this full path looks something like C:\Program Files\Java\jdk1.7.0\bin. Set the PATH variable as follows on Microsoft Windows:

  1. Click Start, then Control Panel, then System.
  2. Select Advanced, then Environment Variables.
  3. Add the location of the bin folder of the JDK installation for the PATH variable in System Variables. The following is a typical value for the PATH variable:
C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.7.0\bin

Notes: You can add multiple directories separated with semicolons(;).
      PATH Environment variables are Not Case Sensitive. 

No comments :

Post a Comment