Installing OpenJDK 9 on Debian Stretch

A fresh cup OpenJDK 9, brewed on Debian Stretch

From 21 Sep 2017 on we have OpenJDK 9 in the backports repository for Debain Stretch. Perform the following steps to install version 9 on your machine:

Prepare your system:

Version 9 of OpenJDK did not make it into the standard repositories for Debian Stretch but is available via backports repository. To be able to use it add the following lines to the end of your /etc/apt/sources.list file:

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

Install OpenJDK 9

The installation of version 9 is then straight forward:

sudo apt-get update
sudo apt-get install -t stretch-backports openjdk-9-jdk

Check your default Java version

Normally, OpenJDK version 9 should be your default Java version by now. Verify this by performing this simple check:

java -version

On my 64-bit system the output is:

openjdk version "9-Debian"
OpenJDK Runtime Environment (build 9-Debian+0-9b181-4bpo91)
OpenJDK 64-Bit Server VM (build 9-Debian+0-9b181-4bpo91, mixed mode)

Set the default java version manually

In case the previous step did not show version 9 as your default java version you can set it manually.

  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.8.0-openjdk-amd64 1081 /usr/lib/jvm/java-1.8.0-openjdk-amd64
    java-1.9.0-openjdk-amd64 1091 /usr/lib/jvm/java-1.9.0-openjdk-amd64
    
  2. To update your all relevant symlinks at once use:
    sudo update-java-alternatives --set java-1.9.0-openjdk-amd64

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

This article is a follow up to installing OpenJDK 8 on Debain Jessie

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.

Leave a Reply

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