Biggest pain in the ass when I changed my OS to Ubuntu were errors caused by mix up of SUN and Open Java Versions available.
Set Environment Variable
To save some trouble set the $JAVA_HOME variable in .bashrc etc.
export $JAVA_HOME=/your/java/home/path (e.g., /usr/lib/jvm/java-6-sun) export PATH=$PATH:$JAVA_HOME/bin
Set Java Configuration
If you have to have two versions or as in my case Open Java is re-installing through means of magic, select the right version by
sudo update-alternatives --config java
So far so good…