How to Set the JAVA_HOME Variable in Windows 10

Set the Java_Home Variable In Windows 10

JAVA_HOME is an environment variable (in Unix terminologies), or a PATH variable (in Windows terminology). A lot of well behaving Java applications (which need the JDK/JRE) to run, looks up the JAVA_HOME variable for the location where the Java compiler/interpreter may be found.

After you’ve installed Java in Windows, you must set the  JAVA_HOME  environment variable to point to the Java installation directory.

This information is only relevant if you’ve installed JAVA JDK or JAVA JRE in Windows.

There are two scenarios:

  1. If you installed the Java Development Kit (JDK) you’ll be setting the JAVA_HOME environment variable.
  2. If you installed the Java Runtime Environment (JRE) you will follow the same steps but set the JRE_HOME environment variable instead.

Set the JAVA_HOME Variable

To set the JAVA_HOME variable:

  1. Find out where Java is installed. If you didn’t change the path during installation, it would be something like this:C:Program FilesJavajdk1.8.0_65 
  2. In Windows 7 right-click My Computer and select Properties > Advanced.In Windows 8 go to Control Panel > System > Advanced System Settings.
  3. Click the Environment Variables button.
  4. Under System Variables, click New.
  5. In the Variable Name field, enter:
    • JAVA_HOME if you installed the JDK (Java Development Kit)
    • JRE_HOME if you installed the JRE (Java Runtime Environment)
  6. In the Variable Value field, enter your JDK or JRE installation path.If the path contains spaces, use the shortened path name, for example


Note for Windows users on 32-bit & 64-bit systems

Progra~1 = ‘Program Files’ //This is for 64bit users
Progra~2 = ‘Program Files(x86)’ // This is for 32bit users

  1. Click OK and Apply Changes as prompted.

Things to know and do after computing the tutorial:

  • You’ll need to close any re-open any command windows that were open before you made these changes.
  • As there’s no way to reload environment variables from an active command prompt.
  • If the changes don’t take effect even after reopening the command window, restart Windows.

Thanks for reading this tutorial. If you have any questions, you can ask me in the comments section below.

Leave a Reply

Be the First to Comment!

Notify of