Installing OpenJDK 8 on Debian Jessie

A cup OpenJDK 8 java beans :-)

Be aware that this tutorial was written for Debian Jessie. If you are using Debian Stretch (or Ubuntu Xenial Xeres / Bionic Beaver) you can just install OpenJDK version 8 right away or learn how to install OpenJDK 9

Since OpenJDK 8 is out there since march 2014 I wanted to install it on my freshly setup Debian Jessie. But trying to, I was surprised that the OpenJDK is only available in version 7. To successfully install version 8 you need to perform the following steps:

Prepare your system

The desired version of OpenJDK is not available in out-of-the-box Debian Jessie. So you have to rely on Debian Backports repository and add the following lines to the end of your /etc/apt/sources.list file:

# jessie backports
deb http://http.debian.net/debian jessie-backports main

Install OpenJDK 8

The installation of version 8 is then straight forward:

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

Make version 8 your default Java

This step is optional. Debian provides a neat Tool to change default Java on your system.

  1. To check which JDK-Versions are available on your system perform:
    sudo update-java-alternatives --list

    On my system (64-bit) the output is:

    java-1.7.0-openjdk-amd64 1071 /usr/lib/jvm/java-1.7.0-openjdk-amd64
    java-1.8.0-openjdk-amd64 1069 /usr/lib/jvm/java-1.8.0-openjdk-amd64
  2. To update your all relevant symlinks at once use:
    sudo update-java-alternatives --set java-1.8.0-openjdk-amd64

    (in a 32-bit environment use -i386 postfix instead of -amd64)

You can ignore the errors about to a missing java plugin as you probably just did not install the java browser plugin.

Author: xmoex

I'm a computer sience student currently working on my master's degree. At the moment I'm interested in the topics C++, Java and parallelization.

15 thoughts on “Installing OpenJDK 8 on Debian Jessie”

  1. Thank you !
    This is the command that I needed to solve my problem sudo apt-get install -t jessie-backports openjdk-8-jdk

Leave a Reply

Your email address will not be published. Required fields are marked *