The environment variable JAVA_HOME sets the location of your Java SDK so it can be accessed from various locations.
Navigate to Start > Control Panel > System.
Choose the Advanced tab.
Click Environment Variables.
In the System Variables pane, click New.
For Variable Name, type JAVA_HOME.
For Variable Value, type C:\j2sdk1.5.0 for a default installation of the SDK. You may need to adjust your value based on your installation.
Type the following code at the shell (you may need to change the location of the Java home directory for your system):
$ export JAVA_HOME=/home/usr/jdk1.5
To set the JAVA_HOME into the PATH, type the following:
$ export PATH=$JAVA_HOME/bin:$PATH