apt can’t locate openjdk-16-jre-headless because the OpenJDK 16 packages aren’t available in any Debian release.
The only release available to you in Debian 10 is OpenJDK 11. Debian 11 has OpenJDK 17. Both of these are releases with long-term support.
Answer from Stephen Kitt on Stack ExchangeI am trying to install Ghidra on a newly spun up Debian machine. When I run sudo apt-get install -y openjdk-11-jdk it fails with E: Unable to locate package openjdk-11-jdk. When I run java -version, it says I am running version 16.0.1. How do i revert to the openjkd-11? Or is something else going on that's wrong?
apt can’t locate openjdk-16-jre-headless because the OpenJDK 16 packages aren’t available in any Debian release.
The only release available to you in Debian 10 is OpenJDK 11. Debian 11 has OpenJDK 17. Both of these are releases with long-term support.
openjdk-16-jre-headless isn't packaged on Debian. You have to use openjdk-11-jre-headless, it can be installed after enabling the security repository.
Java and debian.
To install OpenJDK 11 in Ubuntu, use the commands listed below.
- Add the repository
sudo add-apt-repository ppa:openjdk-r/ppa
- Update package list
sudo apt-get update
- Install
openjdk-11-jdk
sudo apt install openjdk-11-jdk
I had this error while building a Dockerfile. The solution was to install default-jre instead:
sudo apt-get install -y default-jre
I recently upgraded my Debian version to the shiny new Debian 12, and I'm currently facing a small hiccup while trying to install OpenJDK-11. I'm aware that the apt install default-jdk command usually does the trick, but in this case, it installs version 17 of OpenJDK. Unfortunately, I specifically need JDK 11 for my project.
I successfully used apt install default-jdk in Debian 11 without any issues, so I'm wondering if there have been any changes in Debian 12 that require a different approach for installing OpenJDK-11. I'd greatly appreciate it if anyone could kindly guide me through the correct steps to install OpenJDK-11 on Debian 12.
Thank you in advance for your time and assistance!
You are on Debian 10 (buster), but the link you showed is for Debian 9 (stretch).
OpenJDK is on version 11 for Buster and OpenJDK 8 is not available.
https://packages.debian.org/buster/openjdk-11-jdk
If you need this, use a docker image based on Stretch.
Apparently Debian 10 alias Buster only provides openjdk 11 packages.
In my case this meant using debian 9 alias stretch instead. I must admit it wasn't very clever using latest as a version in the first place.
before:
FROM debian:latest
after:
FROM debian:stretch
Debian stretch is a LTS version supported until 06.2022