I am installing Apache Solr on Linux Debian (Squeeze). I have been instructed to install sun-java jdk 1st. Then am told that I should use the command sudo update-alter
sudo update-alter
If you want to switch the jdk on a regular basis (or update to a new one once it is released), it's very conveniant to use sdkman.
You can additional tools like maven with sdkman, too.