Installing Java 8 on Ubuntu 16.04

Introduction

There are lots of applications and websites that will not work unless you have Java installed, and more are created every day. Java 8 is released with many of new features and security updates, it is also known to perform much better than older versions of Java.

Installing Webup8 Java PPA

Oracle Java PPA for Ubuntu is maintained by Webup8, we need to add Webup8 repository to APT before we can install Java 8 using apt-get.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update

Installing Java 8

Now use the following command to install Java 8 on your Ubuntu server. This will automatically download and install Oracle Java 8.

sudo apt-get install oracle-java8-installer

Setting up Java 8 Environment Variables

Webup8 PPA repository provides a package to set Java 8 environment variables, you can install this package by using the following command.

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

Verify Java Version

You can use the following command to make sure that you have Java correctly installed and Java environment is using Java 8.