Install Oracle Java 12 on Ubuntu

You need to add the PPA. (Surce: “Linux Uprising” team)

sudo add-apt-repository ppa:linuxuprising/java
sudo apt-get update
sudo apt-get install oracle-java12-installer
sudo apt-get install oracle-java12-set-default 

For multiple java versions, install [or uninstall] oracle-java12-set-default package to set [or not] Java 12 as default.

post@lnrsoft:$ java --version
java 12.0.1 2019-04-16
Java(TM) SE Runtime Environment (build 12.0.1+12)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)

Remove it: … use the following command if you need to uninstall it:

sudo apt-get remove oracle-java13-installer