The environment variable JAVA_HOME sets the location of your Java SDK so it can be accessed from various locations.
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