Install JDK
This information is now maintained on my wiki http://www.mikepalmer.net/wiki/ApacheTomcatHowto.
- go to http://java.sun.com and download the current version of J2SDK
- Install the J2SDK. I copied the .bin file from the previous step to /usr/local/, then ran it:
cp -p j2sdk-1_4_2_03.bin /usr/local/
./j2sdk-1_4_2_03.bin
This leaves /usr/local/j2sdk-1_4_2_03.
- Set JAVA_HOME as an environment variable, pointing to the location of the J2SDK you just installed, in this case /usr/local/j2sdk-1_4_2_03. If you want this environment variable to be available to every user system-wide, then put the following two lines into /etc/profile:
JAVA_HOME=/usr/local/j2sdk-1_4_2_03
export JAVA_HOME
- Verify that JAVA_HOME is set:
echo $JAVA_HOME
You should see the value /usr/local/j2sdk-1_4_2_03 returned. If you don't, go back through the steps until JAVA_HOME resolves to the correct value.
- Set your CLASSPATH
CLASSPATH=${JAVA_HOME}/lib/tools.jar:${JAVA_HOME}/jre/lib/ext/mail.jar:${JAVA_HOME}/jre/lib/ext/activation.jar
export CLASSPATH