Setting the JAVA_HOME Variable in Windows
After you've installed Java in Windows, you must set the
JAVA_HOME environment variable to point to the Java installation directory.
If you installed the Java Development Kit (JDK) you'll be setting the
JAVA_HOME environment variable. 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:
Locate the Java installation directory
- Do one of the following:
Windows 7 – Right click My Computer and select Properties > Advanced
Windows 8 – Go to Control Panel > System > Advanced System Settings
- Click the Environment Variables button
- Under System Variables, click New
- In the Variable Name field, enter either:
JAVA_HOMEif you installed the JDK (Java Development Kit)
JRE_HOMEif you installed the JRE (Java Runtime Environment)
In the Variable Value field, enter your JDK or JRE installation path
- Click OK and Apply Changes as prompted
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 after reopening the command window, restart Windows.
Was this helpful?
Thanks for your feedback!