Setting JAVA_HOME Variable in Windows
In this example we will set the JAVA_HOME variable in Windows. The JAVA_HOME variable is used by applications to find the Java Development Kit installation.
Find JDK Installation Directory
First you need to know the installation path for the Java Development Kit.
Open the default installation path for the Java Development Kit
C:\Program Files (x86)\Java
There should be a subdirectory like
C:\Program Files (x86)\Java\jre6
Set the JAVA_HOME Variable
Once you have the JDK installation path:
- Right-click the My Computer icon on your desktop and select Properties.
- Click the Advanced tab.
- Click the Environment Variables button.
- Under System Variables, click New.
- Enter the variable name as JAVA_HOME.
- Enter the variable value (one of the paths mentioned above) as the installation path for the Java Development Kit.
- Click OK.
- Click Apply Changes.
You might need to restart windows.