Before April 2019, the best way to install Oracle JDK on Ubuntu was to use PPA (Personal Package Archives). One of those options is ppa:webupd8team/java, for example. Its commands automatically download and install Oracle JDK for you. However, Oracle's policy has changed. Whoever wants to download Oracle JDK must log in with an account and accept their terms. So PPAs such as webupd8team/java and so on are no longer working.
Thus, to install Oracle JDK on Ubuntu, you need to manually download the installer, and install it with a few simple commands.
Instead of installing Oracle JDK as in this article, you can install OpenJDK according to the instructions below, both Oracle JDK and OpenJDK are maintained and developed by Oracle.
Note: Oracle has a long-term supporting plan for Java versions 8, 11, and 13; therefore, it is best to use one of these versions.
In this article, I'm going to guide you on how to install Oracle JDK 11, and similarly, you can possibly do with other versions.
First of all, you need to visit the address below to download Oracle JDK:
After that, you get a file:
Use a command to extract the file that you have already downloaded in the previous step.
After extracting the file, you receive a folder. Next, move that folder to /usr/local/java:
Lastly, see what your installation result is: