Open In App

How to set Temporary and Permanent Paths in Java

Last Updated : 24 Mar, 2018
Improve
Improve
Like Article
Like
Save
Share
Report

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.

      Like Article
      Suggest improvement
      Previous
      Next
      Share your thoughts in the comments

Similar Reads