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\Java
or
C:\Program Files (x86)\Java
There should be a subdirectory like
C:\Program Files\Java\jre6
or
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.



Ravindra April 28th
Hi,
This is a very decent article for the new developers for JAVA
dude503 July 1st
Your example above is defining the location of the JRE not the JDK and this may cause failure by some tools.
How would you define the variable, to get around the problem of the spaces in the windows directory path, that some tools may not cope with?
e.g. on Windows 7, the 32-bit JDK could be
C:\Program Files (x86)\Java\jdk1.7.0
so would you define that as
“C:\Program Files (x86)\Java\jdk1.7.0″ ?
Thanks.
Thinkx July 8th
Thanx. This was help me lot..
babanna August 23rd
thanks. Very simple steps and very helpful…
specky September 16th
Your Message…thanks very much buddy
fahad November 24th
not working for me
..
..
i have windows 7 64 bit ..
i try above solution but no use
still unable to use any java tool …
please help
jeevan November 25th
what is the sixth step? can you please explain…..
naif March 12th
best help .. )
chaitanya April 14th
Thanks it helped
Vittal May 6th
Many Thanks… it was v helpful
Add Yours
YOU