In this tutorial we will learn how to set Java Path in Windows 10, not only on Windows 10, you can set Java Path on any Windows operating system if you follow the steps below, because the steps are the same for all Windows operating system.
As we know that before setting up Java Path, we need to have Java installed on our system and we consider that Java has been successfully installed on your system. And if you do not have Java installed on your system then go to the link below and install Java on your system.
- Read Also :- How to download & installed Java in windows 10.
How to set java path in windows 10.
Please follow the steps below to set up Java path.
Step – 1. Copy the path of bin folder.
Locate the Java installation folder and copy the path up to the bin folder.
Example:- C:\Program Files\Java\jdk-17.0.2\bin
Step – 2. Go to the Windows search box and type Edit the system environment variables, you can see the result and click on it and a new dialog box will open.
Step – 3. In the System Properties dialog, go to the Advanced tab and then click the Environment Variables button, and a new dialog box will open.
Step – 4. In the Environment Variables dialog, click on Path then press the Edit button, and you will see a new dialog box open.
Step – 5. In Edit in Environment Variable dialog, first click on the New button then there will be a place where you will paste the Java bin folder path that you copied first.
( Ex.– C:\Program Files\Java\jdk-17.0.2\bin )
Now click on Ok button and java path is set successfully, But one more thing you need to do to complete the setup that is to set up JAVA_HOME.
Why do we need to set JAVA_HOME?
JAVA_HOME needs to be set because there are many Java based programs on the market such as Tomcat requires JAVA_HOME environment variables to work properly. and JAVA_HOME environment variable points to directory where java is installed on your system.
How to set JAVA_HOME in Windows 10.
Step – 6. In the Environment Variables dialog, Click the New button, and the New User Variable dialog box will open.
Step – 7. Type JAVA_HOME as a Variable name, and paste the JDK directory under Variable values, We actually copied the Java installation directory up to the bin folder in the first step so we will paste it and we will remove bin and it will be like C:\Program Files\Java\jdk-17.0.2 and click OK.
Step – 8. JAVA_HOME is set, now click on OK button.
Step- 9. Close all the dialog boxes step by step by clicking the OK button. And we’ve done all the setup.
So let’s check, is Java Path fully configured?
So, open Command Prompt (Press Windows logo + r and type there cmd and press Ok) and type
java -version press enter
javac -version press enter
This is the steps to set java path in windows operating system, we hope you have successfully set up java path on your system, and if you face any problem regarding this setup, please mention in the comment box, we are always ready to help you.
- Read Also :- How to run java program in CMD.