After you have downloaded and installed the Java Development Kit (JDK) in Windows, you must set the JAVA_HOME environment variable to point to the JDK installation directory.
You must follow these steps to set JAVA_HOME variable on your Windows system.
Right-click the My Computer icon on your desktop and select Properties.
Click Advanced system settings link.
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 as the installation path for the Java Development Kit as something like this C:\Program Files\Java\jdk1.6.0_45
Under System Variables, select Path system variable
Scroll to the beginning of the Variable value and insert %JAVA_HOME%\bin;
If the changes do not take effect restart Windows.