JDK Configuration
Configure JDK
Set the JAVA_HOME environment variable to the root location of the JDK installation directory. The examples below use C:\jdk1.5 for Windows and/opt/jdk1.5 for UNIX, but be sure to use the actual location on your system. (e.g. The default installation location used by the JDK installer might be something like C:\Program Files\Java\jdk1.5.0_06)
Windows: C:\> set JAVA_HOME=C:\jdk1.5
UNIX Korn Shell: $ export JAVA_HOME=/opt/jdk1.5
Next set the PATH environment variable to include the JDK bin directory. The PATH variable tells the operating system where to find the java interpreter and the javac compiler.
Windows: C:\> set PATH=%PATH%;%JAVA_HOME%\bin
In Windows, these envoronment variables can also be set from - right click "My Computer" -> Advanced -> Environment Variables.
UNIX Korn Shell: $ export PATH=$JAVA_HOME/bin:$PATH
Verify JDK
Use the java -version command, as shown below, to verify the installed release:
java -version java version "1.5.0_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
The output you see may be different from what is shown above because the java -version command outputs vendor-specific information; however, if you don't see what looks like valid version information, then STOP! And don't proceed until you resolve that problem.
reference: http://db.apache.org/derby/papers/DerbyTut/install_software.html#jdk_configure