Simply put, open a terminal window and enter following commands:
sudo add-apt-repository ppa:linuxuprising/java <enter>
sudo apt update <enter>
sudo apt install oracle-java12-installer <enter>
After the installation is complete, you can verify that the Java plugin has been installed by starting your Firefox web browser and typing about:plugins in the URL box.
Make Oracle 12 as the default Java Environment in Ubuntu, LinuxMint:
sudo apt install oracle-java12-set-default <enter>