Installing Java 8 and Java 11 on Debian 13 and Debian 12

Published on Updated on 5 min read

Debian ships neither Java 8 nor, from Debian 12 onwards, Java 11. Here is how to install both versions cleanly with apt anyway, using the Adoptium repository and Eclipse Temurin.

Want to install Java 8 or Java 11 on your Debian server? One thing up front: both versions have disappeared from the official Debian package sources. Neither Debian 13 (Trixie) nor Debian 12 (Bookworm) contains openjdk-8 or openjdk-11. An apt install openjdk-11-jre-headless simply fails there. The reliable route leads through Eclipse Temurin.

Requirements

You need SSH access with root privileges (or a user with sudo permissions) on a current Debian. Debian 13 "Trixie" and Debian 12 "Bookworm" are recommended. Debian 10 reached its end of support in June 2024 and no longer receives regular security updates.

This command shows which Debian version you are running:

cat /etc/os-release

Then refresh the package list and apply any pending updates:

apt update && apt upgrade -y

Which Java version ships with which Debian?

This overview shows what is actually available in the official Debian package sources (as of July 2026):

PackageDebian 13Debian 12Debian 11
openjdk-8-jre-headlessnot includednot includednot included
openjdk-11-jre-headlessnot includednot included11.0.31
openjdk-17-jre-headlessnot included17.0.1917.0.19
openjdk-21-jre-headless21.0.11not includednot included
openjdk-25-jre-headless25.0.3not includednot included

So there is no package left for Java 8 in Debian at all, and Java 11 is only found in Debian 11. You can check for yourself at any time whether a package is available on your system:

apt-cache policy openjdk-11-jre-headless

If the entry (none) shows up under "Candidate", the package does not exist in your Debian version.

Which Java version do you actually need?

Java 8 and Java 11 are older LTS releases. Current software usually targets Java 17 or Java 21, but some server applications (older Minecraft servers, plugins or long-grown enterprise software, for example) still run only with Java 8 or Java 11. So install an older version only when your application explicitly requires it. Check the documentation first to see whether a newer version is supported after all, because that one receives security updates for considerably longer.

Installing Java 8 and Java 11 from the Adoptium repository

Eclipse Temurin is a freely available OpenJDK build. The Adoptium repository provides versions 8 through 26 for Debian 13, and the same package source is available for Debian 12 as well. That way you can install any Java version you need, regardless of what your distribution ships, and update it afterwards through apt like any other package.

Setting up the Adoptium repository

First install the required helper packages and create the directory for repository keys:

apt install -y wget gpg apt-transport-https ca-certificates

mkdir -p /etc/apt/keyrings

Next, download the signing key and add the package source. The sources line points explicitly to this one key via signed-by=, so the key applies to this repository only:

wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc

echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list

apt update

Installing Java 8

apt install temurin-8-jre -y

The jre variant contains only the runtime environment and is enough to run Java applications. If you also need a compiler, install temurin-8-jdk instead.

Installing Java 11

apt install temurin-11-jre -y

The same applies here: for development and compiling, take temurin-11-jdk.

Installing Java 11 on Debian 11 from the repository

If your server still runs Debian 11 "Bullseye", OpenJDK 11 is still sitting in the official repository there:

apt install openjdk-11-jre-headless -y

Debian 11 only receives limited LTS security updates, though. Plan an upgrade in the medium term and move Java over to Temurin while you are at it, so you are not left without a matching package after the version jump.

Alternative: using the Debian default version

If your application does not demand a specific Java version but simply needs a current Java, the metapackage is the most convenient route:

apt install default-jre-headless -y

Depending on your Debian version, this gives you the following Java:

DistributionJava version via default-jre-headless
Debian 13Java 21
Debian 12Java 17
Debian 11Java 11

On Debian 11 you therefore get exactly Java 11, while newer Debian versions give you a considerably more recent release.

Verifying the installation

Finally, check whether the installation succeeded. Query the installed Java version:

java -version

If the output shows the major version you wanted (that is 1.8.0 for Java 8 or 11.0 for Java 11), the installation worked.

Setting the default Java version

If several JDKs are installed, the alternatives system decides which version starts when you run java. First list all versions present:

update-alternatives --list java

Then pick the version you want interactively:

update-alternatives --config java

Why you should no longer use apt-key

Many older guides add third-party sources with apt-key adv or apt-key add. That command has been deprecated since Debian 11, because a key stored this way becomes valid for all package sources on the system. A compromised third-party repository could then slip in system packages as well.

The modern approach is exactly the one shown above: the key ends up as a single file under /etc/apt/keyrings/ and is tied to exactly one repository through signed-by= in the sources line.

Common errors and fixes

"Unable to locate package openjdk-8-jre-headless" or "openjdk-11-jre-headless": This is not a fault of your installation. Debian no longer contains a package for Java 8 at all, and Java 11 only in Debian 11. Install the version from the Adoptium repository.

"Unable to locate package temurin-8-jre": The repository has not been read in yet. Run apt update and check with cat /etc/apt/sources.list.d/adoptium.list that the correct codename for your Debian version sits at the end of the line (for example bookworm or trixie).

"NO_PUBKEY" or signature errors during apt update: The key was not stored correctly. Download it again to /etc/apt/keyrings/adoptium.asc and make sure the file is not empty.

java -version shows the wrong version: A different Java installation is set as the default. Correct that with update-alternatives --config java.

Frequently asked questions

Why does apt not find openjdk-11-jre-headless on Debian 12?
Because the package no longer exists there. OpenJDK 11 is left in the official package sources of Debian 11 only. On Debian 12 and Debian 13 you install Java 11 from the Adoptium repository, using the package temurin-11-jre.
How do I install Java 8 on Debian?
No current Debian version has a package for Java 8. Add the Adoptium repository and install temurin-8-jre, or temurin-8-jdk for development work. The signing key is stored under /etc/apt/keyrings in the process.
Which Java version do I get with default-jre-headless?
The metapackage resolves to the default version of your distribution: Debian 13 gives you Java 21, Debian 12 gives you Java 17 and Debian 11 gives you Java 11. It does not help for Java 8, and for that there is no way around Temurin.
Why should I no longer use apt-key?
A key added with apt-key is valid for all package sources on the system. A compromised third-party repository could use it to slip in system packages as well. The command has been deprecated since Debian 11, and modern guides place the key under /etc/apt/keyrings and reference it with signed-by in the sources line.
Should I still be using Java 8 at all?
Only when your application explicitly requires it. Java 17, Java 21 and Java 25 receive security updates for considerably longer. So check the documentation of your software to see whether a newer Java version is supported.

Java 8 Java 11 OpenJDK Eclipse Temurin Debian 13 Debian 12 Debian Java installieren