Set Java Home variable in windows

Java 0 Comment

How to set  JAVA_HOME environment variable to point to the Java installation directory.

  • If you installed the Java Development Kit (JDK) set JAVA_HOME environment variable.
  • If you installed the Java Runtime Environment (JRE)  set the JRE_HOME environment variable. [The steps remain the same]


  1. Locate your Java installation directory
    If you didn’t change the path during installation, it’ll be something like C:\Program Files\Java\jdk1.8.0_91
  2. Go to Control Panel\System and Security\System -> Advanced system settings
  3. Click the Environment Variables button
  4. Under System Variables, click New
  5. In the Variable Name field, enter either:
    JAVA_HOME if you installed the JDK (or) JRE_HOME if you installed the JRE
  6. In the Variable Value field, enter your JDK or JRE installation path
  7. Click OK and Apply.


Open command prompt and type ‘java -version’. You should see the response like below:

java version “1.8.0_91”
Java(TM) SE Runtime Environment (build 1.8.0_91-b15)


  • If the path contains spaces, use the shortened path name. For example, C:\Progra~1\Java\jdk1.8.0_91
  • For Windows users on 64-bit systems
    Progra~1 = ‘Program Files’
    Progra~2 = ‘Program Files(x86)’

  • Close and reopen any command prompt windows you might have kept opened before executing these steps.


Leave a comment


Back to Top