Install Java8 on Trusty

I was trying to get Java8 working on Ubuntu Trusty to install a Cassandra cluster.

I couldn’t immediately find a tutorial that worked out of the box on a minimal Ubuntu machine, so I thought I’d share what worked for me.

First, this looks good:, so I followed that.

Add PPA location

I ran into an error right away while trying to add the PPA location:

sudo: add-apt-repository: command not found

I fixed it with this:

sudo apt-get install software-properties-common python-software-properties -y

At this point, I was able to add the PPA location:

sudo add-apt-repository ppa:webupd8team/java

Then, you have to update apt-get:

sudo apt-get update

Install Java8

Let’s install Java8:

sudo apt-get install oracle-java8-installer -y


Let’s add JAVA_HOME for the current session, and make it persistent:

export JAVA_HOME=/usr/lib/jvm/java-8-oracle
sudo nano /etc/environment




Confirm that everything went smootly with the following command, which should show the right version:

java -version


One thought on “Install Java8 on Trusty

Leave a Reply

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