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:


    1. doesn’t work anymore.
      “the installer is not available”
      the licences have changed …

  1. waste of my time
    Bill Shy

  2. thanks for giving me those commands. Almost died because of the new java..

  3. Thanks bro!!!

  4. thank it is very important to publish true tutorial thank best regar

  5. Please… stop suggesting WebUpd8! This PPA has *not* been updated for 18.04 and it’s frustrating to get this working!

    1. I had to use OpenJDK to do my work. How did you get The Oracle version of Java working?

  6. waster of my time

    Package oracle-java8-installer is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    E: Package ‘oracle-java8-installer’ has no installation candidate

  7. Not working now

  8. Just tried it on 16.04 and works great!

  9. Thanks bro, nice tutor.

  10. I tried with Ubuntu 18.04. It’s works fine! Thanks ( :

  11. Thank you. This helps a lot

  12. This command sequence will install JRE (Java Runtime engine), not the JDK (Java Development Kit).
    The Eclipse and NEtbenas IDEs require JDK to create Java projects and compile Java programs.

    Anyway, it installed JRE 8 on Kubuntu 18.04 without any problems on my computer.
    To install Oracle JDK 8, I will recommend to follow instructions on the Oracle download site.

  13. not found: oracle-java8-installer

  14. does not help any more. waste of time.

  15. OpenJDK 8
    Java 8 is the current Long Term Support version and is still widely supported, though public maintenance ends in January 2019. To install OpenJDK 8, execute the following command:

    sudo apt install openjdk-8-jdk
    Verify that this is installed with

    java -version
    You’ll see output like this:

    openjdk version “1.8.0_162”
    OpenJDK Runtime Environment (build 1.8.0_162-8u162-b12-1-b12)
    OpenJDK 64-Bit Server VM (build 25.162-b12, mixed mode)
    It is also possible to install only the JRE, which you can do by executing sudo apt install openjdk-8-jre.

      You’ve saved my day.
      It really works on a fresh Ubuntu 18.04.4 x86_64

  16. Guys, you really need to re-write that article as it is totally outdated.
    See comments.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.