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




Stuart is a software developer with a passion for Linux and open source projects.

comments powered by Disqus
We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to and affiliated sites. More info.