How to set Temporary and Permanent Paths in Java?

JavaObject Oriented ProgrammingProgramming

There are two ways to set the path in java, First is Temporary Path and second is Permanent Path.

Setting Temporary Path

  • Open command prompt in Windows
  • Copy the path of jdk/bin directory where java located (C:\Program Files\Java\jdk_version\bin)
  • Write in the command prompt: SET PATH=C:\Program Files\Java\jdk_version\bin and hit enter command.

Setting Permanent Path

  • Go to My Computer ---> Right Click on it ---> Advanced System Settings ---> Advanced Tab ---> Click on Environment Variables
  • Click on New tab of User variables, assign value JAVA_HOME to Variable Name
  • java\jdk_version\bin path (copied path) to Variable Value and click on OK Button
  • Finally, click on OK button.
Updated on 11-Feb-2020 07:39:28