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.

#!/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

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

This blog is created by Stuart Page

I'm a freelance web developer and technology consultant based in Surrey, UK, with over 10 years experience in web development, DevOps, Linux Administration, and IT solutions.

Need support with your infrastructure or web services?

Get in touch