Automation QA Testing Course Content

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, the path is not required to be set because all the tools will be available in the current directory.

However, if you have your Java file outside the JDK/bin folder, it is necessary to set the path of JDK.


There are two ways to set the path in Java:
  1. Temporary
  2. Permanent

1) How to set the Temporary Path of JDK in Windows

To set the temporary path of JDK, you need to follow the following steps:
  • Open the command prompt
  • Copy the path of the JDK/bin directory
  • Write in command prompt: set path=copied_path

For Example:

set path=C:\Program Files\Java\jdk1.8.0_144\bin

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 This PC -->properties

2)Click on the advanced Settings tab
3) Click on environment variables

how to set path in java


4) Click on the new tab of user variables
how to set path in java
5) Write the path in the variable name
how to set path in java
6) Copy the path of bin folder from c:Program Files\Java\jdk 1.8
  1. System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
  2. In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.





No comments:

Post a Comment

Note: Only a member of this blog may post a comment.