Somewhat related  invoking sudo update-alternatives --config java will allow you to take care of various JDKs in Ubuntu (all of which are in /usr/lib/jvm if you install using apt) This doesn't set JAVA_HOME  though