opent the file /etc/bashrc with your favourite text editor and add the following lines to the top of the file
Ivan Jozsef Balazs
Joined: May 22, 2012
I make wrapping scripts for the different versions like javac15, java16, javap17, and put them on PATH and invoke from them the corresponding java executables with their full path name.
I found this to be a convenient way of peaceful coexistence of different Java versions.
That is an argument against a common global setting.