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 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!
I 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
If i try to install using sudo apt-get install openjdk i get unable to locate package openjdk and if i try to add a repo i get the error in the photo so i cant install java using this repo i found in a tutorial
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
Hi everyone,
I’ve been using Debian-based images for most of my Docker containers without issues, but I recently ran into a strange problem. I’m trying to install openjdk-21-jre on debian:bookworm-slim, but I keep getting an “unable to locate package” error.
After some digging, I realized that the default Bookworm repositories only go up to JDK 17, even though Bookworm is the latest stable Debian release. However, when I switched to debian:sid (unstable), I was suddenly able to install OpenJDK 21 via apt with no problem.
I know that Sid is considered unstable, so I’m hesitant to use it in production. Can someone explain why this works this way? And more importantly, what’s the best approach to use OpenJDK 21 in production with Docker? Should I rely on debian:sid, or is there a cleaner or safer way to get JDK 21 while staying on debian:bookworm-slim?
Thanks in advance!
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!