How to Set Path in Java

How to set the Temporary Path of JDK in Windows

To set the temporary path of JDK, you need to follow the following steps:

For Example:

set path=C:\Program Files\Java\jdk1.6.0_23\bin

Let's see it in the figure given below:

How to set Permanent Path of JDK in Windows

For setting the permanent path of JDK, you need to follow these steps:

For Example:

  1. Go to MyComputer properties
  2. Click on the advanced tab
  3. Click on environment variables
  4. Click on the new tab of user variables
  5. Write the path in the variable name
  6. Copy the path of bin folder
  7. Paste path of bin folder in the variable value
  8. Click on ok button
  9. Click on ok button
Now your permanent path is set. You can now execute any program of java from any drive.

Setting Java Path in Linux OS

Setting path in Linux OS is the same as setting the path in the Windows OS. But, here we use the export tool rather than set. Let's see how to set path in Linux OS:

export PATH=$PATH:/home/jdk1.6.01/bin/