1) Locate the JDK Installation Directory .By default it will be C:Program FilesJavajdk1.6.0_26 (Latest version at the time of writting this)
2) Right-click the My Computer icon on your desktop and select Properties.ThenClick the Advanced tab.
3) Click the Environment Variables button.Under System Variables, click New and Enter the variable name as JAVA_HOME.
4)Enter the variable value as the installation path for the Java Development Kit. If path name includes space it , replace it with ~
5)Click OK and Click Apply Changes.
6)Restart Windows.