How to install Java 8 on Debian Jessie

Java logo

Despite the fact that Java is becoming a less used programming language, it is true that there are still important applications that need this programming language and its virtual machine. Programs like LibreOffice or web browsers still need this add-on.

Below we explain how to install Java 8 on our Debian Jessie , a simple and easy process for which we will only need a terminal and an internet connection.

There are two ways to get Java 8 on your Debian Jessie system. The first is to use Java 8 itself and install it on your distribution . The second method is to install OpenJDK , a free alternative to Java 8 that works just like Java but is completely free.

To install Java 8 quickly we have to open a terminal in Jessie and write the following:

su -
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
apt-get update
apt-get install oracle-java8-installer
exit

This will install Java 8 on Debian using the Webupd8 repository , a popular and very useful repository with essential programs like Java 8. However, this only installs Java 8 on Debian Jessie; now we need to tell the distribution to use Java 8 when needed. To do this, from the same terminal, type:

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

There is another way to run Java programs without proprietary software . We'll install OpenJDK, a program that works just like Java but is free and open-source. To install OpenJDK, open the terminal and type the following:

echo "deb http://http.debian.net/debian jessie-backports main" | \
sudo tee --append /etc/apt/sources.list.d/jessie-backports.list > /dev/null

sudo apt-get update

sudo apt-get install -t jessie-backports openjdk-8-jdk

And with that, OpenJDK will be installed. Now, as with the previous method, we need to tell Debian Jessie to use OpenJDK as the default program for anyone requesting to use Java . So we need to type the following:

sudo update-java-alternatives -s java-1.8.0-openjdk-amd64

Any of the methods will make Java 8 be on our computer, or at least it will make our applications work correctly without consuming large resources.


Add as preferred source in Google