Changing the default Java environment in Ubuntu
If you have more than one JVM (Java Virtual Machine) installed in your Ubuntu server, e.g. OpenJDK and the Oracle JDK, you can easily select them using the following command:
# sudo update-alternatives --config java
Following the instruction and you can easily set them as you want.