I just came across this and needed to post it somewhere for posterity. Nothing fancy, but a handy tip.
After spending a while trying to work out where my newly updated java version had gone (officially installed through the Ubuntu app store), I came across this old thread which made me aware of the “update-alternatives” command which as you can see totally sorts the problem. I don’t know how far it reaches with other programs/environments, but seems good for versioning. Need to bear it in mind next time a problem like this comes up.