Set the Java_Home Variable In Windows 10

This article will guide you How to set java_home variable classpath in Windows 10!

Note: This can be implemented in Windows 8.1, Windows 8 and Windows 7 too.

JAVA_HOME ” is an environment variable (in Unix terminologies), or a PATH variable (in Windows terminology).

Many Java applications that require the JDK/JRE to run, look up the JAVA_HOME variable for the location where the Java compiler/interpreter may be found.

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

What are the Environment Variables?

Environment variables are global system variables accessible by all the processes running under the Operating System (OS). Environment variables are useful to store system-wide values such as the directories to search for the executable programs (PATH) and the OS version. Examples of environment variables in Windows OS are:

  • COMPUTENAMEUSERNAME: stores the computer and current username.
  • OS: the operating system.
  • SystemRoot: the system root directory.
  • PATH: stores a list of directories for searching executable programs.

In setting up JDK and Java applications, you will encounter these environment variables: PATHCLASSPATHJAVA_HOME and JRE_HOME.


  • PATH: maintains a list of directories. The OS searches the PATH entries for executable programs, such as Java Compiler (javac) and Java Runtime (java)
  • CLASSPATH: maintain a list of directories (containing many Java class files) and JAR file (a single-file archive of Java classes). The Java Compiler and Java Runtime does a search for the ” CLASSPATH ” entries for Java classes referenced in your program
  • JAVA_HOME and JRE_HOME: maintain the locations of JDK and JRE installed directory, respectively

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.

Procedure to Set the JAVA_HOME Variable in Windows 10.

We are assuming that you have a 64-bit system and a 64bit Windows Operating System. For example; Windows 10 64bit.

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 Files\Java\jdk-13.0.2
  2. In the desktop right-click My Computer/This PC/ or open Explorer and select Properties > Advanced.

    You can also go to Control Panel > System > Advanced System Settings.
  3. Then Click the Environment Variables button.
  4. There will be System Variables; now 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 pathname,
    For example: C:\Program Files\Java\jdk-9\13.0.2)
  7. Click OK and Apply Changes as prompted.

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

Finally, you’re done. To observe any effect, you’ll need to close and 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.

4 1 vote
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x