Debian 8 - Install Oracle Java

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

#!/bin/bash
sudo echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | \
sudo tee /etc/apt/sources.list.d/webupd8team-java.list

sudo echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | \
sudo tee -a /etc/apt/sources.list.d/webupd8team-java.list

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
sudo apt-get update
sudo apt-get install oracle-java8-installer -y
exit

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

References

Author

Programster

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 Amazon.com and affiliated sites. More info.