How to set Temporary and Permanent Paths in Java

If the Java source file is inside the jdk/bin folder,path is not required to be set because the tools like javac,java are inside the current folder.
But if the java source file is outside the jdk/bin folder,path is required to be set in order to execute java source file.
There are two ways to set java path:

  1. Temporary
  2. Permanent
  1. Setting Temporary Java Path:
  2. To set temporary java path:

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

    For example:

    SET PATH=C:\Program Files\Java\jdk1.7.0_79\bin

  3. Setting Permanent Java Path:
  4. To set permanent java path:

    1. Go to MyPC properties
    2. Click on Advanced system settings
    3. Click on Environment Variables
    4. Click on New tab of User variables
    5. Assign value Gfg_path to Variable name:
    6. Copy the path of bin folder
    7. Paste path of bin folder in Variable value:
    8. Click on OK button
    9. Click on OK button
    10. In this way Temporary and Permanent Path for Java can be set in Windows.

      My Personal Notes arrow_drop_up

      Check out this Author's contributed articles.

      If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

      Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

      Article Tags :
      Practice Tags :

      Be the First to upvote.

      Please write to us at to report any issue with the above content.