Installing OpenJDK 8 on Debian Jessie

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.