How to Set the Java Path Environment Variable in Windows 10

In this tutorial, we are going to see how to set the Java Path Environment Variable in Windows 10.

If the Java source file is in the jdk/bin folder, you don’t need to set the path because tools like javac and java are in the current folder.

But if the java source file is outside of the jdk/bin folder, the path must be set in order to run the java source file.

There are two ways to define the java path:

  • Temporary
  • Permanent

Define the environment variable temporarily:

Open Command Prompt (CMD), go to where you installed java on your system, and locate the bin directory.

Copy the full path and write it in the command line like this.

set path=C:\Program Files\Java\jre1.8.0_121\bin

Note: your jdk version may be different. Since java version 1.8.0_121 is installed on my system, I used the same when setting the path.


Define the environment variable permanently:

To set the Java environment variable permanently:
1- Access to your computer, then right click on an empty space, and click Properties.

2- Click on Advanced system settings

3- Click on Environment variables

4- Click on the “New” button

5- Assign the value JAVA_HOME to the Variable name:

6- Copy the path of the bin folder

7- Paste the path of the bin folder in Variable value :

8- Click on the OK button of the three windows.

mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *