How to set path in Java

The path is required to be set for using tools such as javac, java etc. If you are saving the java source file inside the jdk/bin directory, path is not required to be set because all the tools will be available in the current directory. But If you are having your java file outside the jdk/bin folder, it is necessary to set path of JDK. There are 2 ways to set java path:

  1. Temporary
  2. Permanent

1) How to set Temporary Path of JDK in Windows

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

  • Open command prompt
  • Copy the path of jdk/bin directory
  • Write in command prompt: set path=copied_path


set path=C:Program FilesJavajdk1.6.0_23bin 2) How to set Permanent Path of JDK in Windows For setting the permanent path of JDK, you need to follow these steps:

    • Go to MyComputer properties -> advanced tab -> environment variables -> new tab of user variable -> write path in variable name -> write path of bin folder in variable value -> ok -> ok -> ok.


    1. Go to Start Menu > Right Click on Computer > Click path
    2. Click on Advanced Setting > System Properties promt window will appear.System Properties
    3. Click on Environment Variables.Environment Variables
    4. Click on New button under System variables enter Variable Name as JAVA_HOME and in Varialble value you have to give your jdk path.Set Variable

Now your permanent path is set.You can now execute any program of java from any drive.

Leave a Comment

%d bloggers like this: