Just edit your ~/.bashrc
file, and add the line defining your JAVA_HOME variable, such as:
Also a handy way to avoid update problems in the future is to create a symbolic link
to your java folder. Basically you point all your variables to a "shortcut", and then you only have to update that shortcut to point to the newest java version, instead of going through all your config files and IDEs to try to find where you defined the java folder. Let me demonstrate what I mean, since I don't think that came off as clear...
Navigate to the parent directory of your java folder, and then run:
ln -s /usr/lib/jvm/java-6-sun-18.104.22.168/ currentjava
Then if you do an "ls -l" in that directory you'll see something resembling:
lrwxrwxrwx 1 root root 21 2009-03-04 15:56 currentjava -> /usr/lib/jvm/java-6-sun-22.214.171.124/
drwxr-xr-x 8 root root 4096 2009-03-04 15:55 java-6-sun-126.96.36.199
And now you can point your JAVA_HOME to /usr/lib/jvm/currentjava/, and then just relink it to the newer version whenever an update is released, which as I said is easier than going through all your config files and updated the path manually.