How to set Java path and JAVA_HOME in Windows 10

Some Java applications require to define JAVA_HOME and Java path. Keep reading and I’ll explain how to do it in Windows 10.

How to set Java Home

You need to do the following to set JAVA_HOME:

Search for Advanced System Settings and launch it:

Open "Advanced system settings" on Windows 10 to set Java home environment variable.

Go to Environment Variables:

Open "Environment Variables" to set Java path and Java home on Windows 10.

Press “New” button in “System variables” section:

Press "New" to add a new system variable in Microsoft Windows 10.

Type name “JAVA_HOME” and value – your path to Java, in my case, it’s C:\Program Files\Java\jre-9.0.4 and press “OK“.

Add new system variable: name is "JAVA_HOME", value is a path to Java Runtime Environment folder.


How to set Java path

Find “Path” system variable and press “Edit“.

Find "Path" system variable and press "Edit" to set Java path in Windows 10 x64.

Press “New” and type “%JAVA_HOME%\bin” to add Java path.

Press "New" to set Java path variable on Windows 10.


Check if JAVA_HOME variable is defined

We set Java home and Java path variables, let’s check is it really working.

Open command prompt.

Open cmd to check JAVA_HOME and Java path in Windows 10.

We can check Java home variable by typing “echo %JAVA_HOME%“.

We can verify the version of Java as well using “java -version” command.

If everything is OK your output like this:

Check JAVA_HOME and Java version on Windows 10.
Scroll Up