Install the Webupd8Team repository in apt. Use the Oracle JDK to install the webupd8Team repository

We will add the Webupd8Team repository using the command add-apt-repository with the following command:

Sudo apt install python-software-properties sudo apt install python-software-properties Sudo add-apt-repository ppa:webupd8team/ Java sudo apt updateCopy the code

Step 2: Install Java

Now we can install Java 6,7, or 8 to check the package list:

oracle-java6-installer
oracle-java7-installer
oracle-java8-installer
Copy the code

Select a package and install it

sudo apt install oracle-java8-installer
Copy the code

The default installation path is /usr/lib/jvm/java-8-oracle

Its installation

Sudo apt install default-jdk # note that this command only applies to Ubuntu16.04Copy the code