How to Install Oracle Java 8 on Ubuntu 16.10 via PPA

If you want to run a program written in Java, then you will need to install JRE (Java Runtime Environment); if you want to begin developing Java programs, then you also need to install JDK (Java Development Kit) which includes JRE, no matter what operating system you use. This tutorial will be showing you how to install Oracle Java 8 on Ubuntu 16.10 via PPA. PPA method is easier and faster than manual installation.

install oracle java 8 on ubuntu 16.10

Once you finish this tutorial, you Ubuntu 16.10 system will have the following:

  • Java JDK (Java Development Kit)
  • JRE (Java Runtime Environment)
  • Java browser plugin

So without further ado, let’s get started.

Install Oracle Java 8 on Ubuntu 16.10 via PPA

Fire up a terminal window (CTRL+ALT+T) and run the following 3 commands to add the PPA, update local package index and install the Java 8 installer.

sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install java-common oracle-java8-installer

Please note that this PPA installs an Oracle Java 8 installer which then download the actual Java files from Oracle website and install it on your system.

During the installation process, you will need to accept the Oracle binary code license terms.

oracle java 8

Once the installation is finished, you can check Java version with the following command:

java -version

install oracle java 8 ubuntu 16.10

And check Java compiler with:

javac -version

oracle java 8 compiler

Setting Environment Variables

The following 4 Java related environment variables should be automatically set once you installed Oracle Java 8 with PPA.

  • $J2REDIR

You can see their values using echo command like below.




If for any reason these environment variable isn’t set, then install oracle-java8-set-default package.

sudo apt-get install oracle-java8-set-default

This package will install a file under /etc/profile.d/ directory. If you take a look at this file, then you can see it’s used to set the above environment variables.

cat /etc/profile.d/


export J2SDKDIR=/usr/lib/jvm/java-8-oracle
export J2REDIR=/usr/lib/jvm/java-8-oracle/jre
export PATH=$PATH:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export DERBY_HOME=/usr/lib/jvm/java-8-oracle/db

We need to reload /etc/profile with the following command to let these environment variables take effect.

source /etc/profile

That’s it!

I hope this tutorial helped you install Oracle Java 8 on Ubuntu 16.10. Subscribe to our free newsletter to get latest Linux tutorials. You can also follow us on Google+Twitter or like our Facebook page.

Rate this tutorial
[Total: 18 Average: 4.4]

3 Responses to “How to Install Oracle Java 8 on Ubuntu 16.10 via PPA

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community ( for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here