okay, before you read the rest of this, try typing "source /etc/profile" into a shell. now does java or javac give you any output? if so, cool. if not...
I'm not sure about package management for your specific distro, but try this:
(it'll take about 5 minutes -- it builds a database of everything on your system, which will make future file searching fast)
Note: if you don't have root access on the machine, you can always run
but it's sloooooow...
anyway, let's say it found java in /opt/sun-jdk-1.4.2_05/bin/javac
then you want your JAVA_HOME to be /opt/sun-jdk-1.4.2_05
if it was found in /usr/local/bin, on the other hand, ignore the rest of this, and simply add /usr/local/bin to your PATH variable.
Now that you know where java is, open up your .bashrc file in a text editor (assuming you're using bash. type "echo $SHELL" to find out your shell, and if it's csh, edit .cshrc, and likewise).
add the following lines to the file: