As you already may know, n years ago Canonical replaced Oracle JDK with OpenJDK as an alternative. If you steel need Oracle JDK on Ubuntu or Mint or other Debian-like system - you are welcome here.

To do so firstly you need to download the prefered version from Java SE Downloads page. In my case it would be Java SE Development Kit 8.

Then just extract it to /usr/java.

$ sudo tar xvzf '/home/kiril/Downloads/jdk-8u162-linux-x64.tar.gz' -C /usr/java

Now you need to to set your JAVA_HOME environment variable.

$ export JAVA_HOME=/usr/java/jdk-8u162-linux-x64/
$ sudo update-alternatives --install /usr/bin/java java ${JAVA_HOME%*/}/bin/java 20000
$ sudo update-alternatives --install /usr/bin/javac javac ${JAVA_HOME%*/}/bin/javac 20000

You may also add export line to ~/.bashrc file.

Now set the Oracle's Java default.

$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac

You will get something like this:

There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/java/jdk1.8.0_162/bin/java                  20000     auto mode
  1            /usr/java/jdk-10/bin/java                        20000     manual mode
* 2            /usr/java/jdk1.8.0_162/bin/java                  20000     manual mode
  3            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

Press <enter> to keep the current choice[*], or type selection number:

Select preferred version and that's all.