How to Set Java PATH in Windows 10

Java is one of the most used programming languages out there, you might be also using it for developing custom software or applications. When you install java on your computer for the first time, one of the very first things you should do is adding its path to the Windows 10 system variables. This will ensure that Windows can execute Java files in order to run your programs. Without it being added to the system variables, Windows will not be able to any of your files written in Java.

By default, while installing Java on your computer, if you are using one of the recent versions of Java, the system variable will be automatically set. However, for some reason, if you are using an older installation or the installer wasn’t able to add the path to your Java installation to the system variables, you will have to manually do that. That’s what we are going to discuss today.

What is the Java Path?

In most cases, on a regular Java installation the path you should add to the system variables is as follows.

C:Program FilesJavajdk1.8.0_31bin

Keep in mind that the “1.8.0_31” will change based on the current version of the JDK you have installed.

Even though just adding the above path to the Windows 10 system variables would work just fine, it is recommended to add one more path as follows.

Variable Name : JAVA_HOME
Variable Value : C:Program FilesJavajdk1.8.0_31

and then add the following to the PATH variable.


The difference is that we added an extra variable “JAVA_HOME” and used that as a reference to the actual variable that we add to the path variable.

Steps to Set Java PATH in Windows 10

  1. Search System in the Windows 10 search bar.
  2. Click on the System option that pops up.
  3. On the right side of the newly opened screen, click on Advanced system settings.
  4. Click on the Environment Variables button at the bottom.
  5. In the System variables section, look for the PATH variable.
  6. Click on it and select Edit.
  7. In the Edit Environment Variables screen, click on the New button to add a new path.
  8. Then input the Java path inside the box and click OK.
  9. Restart your computer.

That’s it, you have successfully added the Java path to your Windows 10 PC. As soon as you restart the computer, Windows will start recognizing the newly added path and will be able to execute code with Java. Happy Java programming.

Leave A Reply

Your email address will not be published.