How to Install Oracle Java 12 on Linux?
Run the following commands on the terminal to install Oracle Java.
sudo add-apt-repository ppa:linuxuprising/java
sudo apt-get update
sudo apt-get install oracle-java12-installer
Additional Information: In Ubuntu 18.04 or later, you can skip the “sudo apt-get update” or command. Because the update process is already done after adding the PPA.
If more than one Java version is installed and you want to set Oracle Java 12 as the default, use the following command.
sudo apt-get install oracle-java12-set-default
If you just want to install Oracle Java 12, but do not want to set it as default, use the following command.
sudo apt-get remove oracle-java12-set-default
You can use the following command to see the version of Java you are installing.
If you want to uninstall Oracle Java 12, use the following command.
sudo apt-get remove oracle-java12-installer