See https://www.linuxuprising.com/2019/03/how-to-install-oracle-java-12-jdk-12-in.html
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>