How to Install Oracle JAVA JDK8 on Ubuntu 16.04 / 17.10 / 18.04 Desktops

Oracle JAVA JDK9 was recently released… however, still many more applications and tools rely on JDK version 8 to function… If you’re going to be installing tools like NetBeans and Eclipse to manage your JAVA based projects, you’re still going to need JDK8 installed… that’s because JDK9 isn’t fully supported…

If you need to get JDK8 installed on Ubuntu 16.04 / 17.10 and 18.04, the steps below should be a great place to start…

This post shows students and new users how to get Oracle Java JDK 8 / JRE via PPA on Ubuntu 16.04 / 17.10 / 18.04 desktop computers.

Oracle Java JDK is a development environment for developing applications and tools based on Java. It can also be used for testing applications and program developed using the Java programming language.

There’s also an alternative open source version of JAVA JDK, however, many applications already developed still rely on the Oracle version of the software…

To install Java JDK 8, follow the steps below:

Step 1: Add A Third Party PPA to Ubuntu

The easiest way to install Oracle Java JDK 8 on Ubuntu is via a third party PPA… To add that PPA, run the commands below

sudo add-apt-repository ppa:webupd8team/java

After running the commands above, you should see a prompt to accept the PPA key onto Ubuntu… accept and continue

Continue below to install Java 8…

Step 2: Download Oracle Java 8 Installer

Now that the PPA repository has been added to Ubuntu, run the commands below to download Oracle Java 8 installer…. the installer should install the latest Java JDK 8 on your Ubuntu machines.

sudo apt update
sudo apt install oracle-java8-installer

When you run the commands above you’ll be prompted to access the license terms of the software… accept and continue..

oracle java 9

Step 3: Configure Oracle JDK8 as Default

Set Oracle JDK8 as default, to do that, install the oracle-java8-set-default package. This will automatically set the JAVA env variable.

sudo apt install oracle-java8-set-default

The command above will automatically set Java 8 as the default… and that should complete your installation, you can check you java version by running following command.

javac -version

That’s it! You have successfully installed Oracle Java JDK 8 on Ubuntu 16.04 / 17.10 / 18.04 via PPA


You may also like the post below:

How to Run Apache2 with PHP7.2-FPM on Ubuntu 16.04 / 17.10 / 18.04