Sometimes its hard to avoid installing multiple Java Virtual Machines (JVM) on your computer because it has something to do with application compatibility or software development purposes.
This creates an annoyance when you just want to run one of the JVM instead of another for a specific task, then having to switch to another JVM for other tasks.
Here’s an easy way to setup a default JVM (Java interpreter and javac) and switch between several JVM in Ubuntu / Debian based distribution.
From the console execute
sudo update-alternatives –config java
Then you’ll be presented with this menu,
Select the Java distribution which best suits you and press enter. You’re done. You can always change the default JVM for your Ubuntu/Debian distribution by repeating this steps.