Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Ubuntu 16.04 - Install Java

Java 8 OpenJDK

This will install Java version 8 from the ubuntu repositories.

sudo apt-get install openjdk-8-jre -y

Oracle Java 9 - Latest Stable

This will use install the latest stable version of Java from Oracle, using a PPA courtesy of the webupd8 team.

sudo apt install python-software-properties software-properties-common -y
sudo add-apt-repository ppa:webupd8team/java -y
sudo apt update
sudo apt install oracle-java9-installer -y

Oracle Java 8 - Previous Version

This will install Oracle's version of Java using a PPA courtesy of the webupd8 team.

sudo apt install python-software-properties software-properties-common -y
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer -y

You probably then want to run the following command to make it the default:

sudo apt install oracle-java8-set-default
Last updated: 1st October 2018
First published: 16th August 2018

This blog is created by Stuart Page

I'm a freelance web developer and technology consultant based in Surrey, UK, with over 10 years experience in web development, DevOps, Linux Administration, and IT solutions.

Need support with your infrastructure or web services?

Get in touch