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

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