setting JAVA_HOME
The instructions at http://www.cyberciti.biz/faq/linux-unix-set-java_home-path-variable/ are slightly out of date or incorrect. Instead of setting
export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.22/bin/java # do NOT do this
as you might expect from their instructions, you should
export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.22/