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.
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
- Search System in the Windows 10 search bar.
- Click on the System option that pops up.
- On the right side of the newly opened screen, click on Advanced system settings.
- Click on the Environment Variables button at the bottom.
- In the System variables section, look for the PATH variable.
- Click on it and select Edit.
- In the Edit Environment Variables screen, click on the New button to add a new path.
- Then input the Java path inside the box and click OK.
- 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.