Right click on 'My Computers' and open 'Properties'.
In Windows Vista or Windows 7, go to "Advanced System Settings". Else go to next step.
Go to 'Advanced Tab' and click on Environment Variables button.
Select 'Path' under the list of 'System Variables', and press Edit and add C:\Program Files\java\jdk\bin after a semicolon.
Now click on 'new' button under system variables and enter 'JAVA_HOME' as variable name and path to jdk home directory (ex. 'C:\Program Files\Java\jdk1.6.0_24' if you are installing java version 6. Directory name may change with diff. java versions) as variable_value.