Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Debian 8 - Install Oracle Java

Execute the following script to install Oracle's version of Java.

sudo echo "deb trusty main" | \
sudo tee /etc/apt/sources.list.d/webupd8team-java.list

sudo echo "deb-src trusty main" | \
sudo tee -a /etc/apt/sources.list.d/webupd8team-java.list

sudo apt-key adv --keyserver hkp:// --recv-keys EEA14886
sudo apt-get update
sudo apt-get install oracle-java8-installer -y

If you need to automatically accept the licence agreement, such as for a Dockerfile, then you will need to add:

echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections

Checking Version

To check the version of Java that is installed, execute the command below:

java -version


Last updated: 16th August 2018
First published: 16th August 2018