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
Answer from Tejas Lotlikar on askubuntu.comUpdate dockerfile please
openjdk issue during node:latest build
Package 'openjdk-11-jre' has no installation candidate
Unable to locate package when installing Java in docker - Stack Overflow
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 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?
I was able to install OpenJDK 8 via the steps below (taken from here). My Dockerfile inherits from phusion/baseimage-docker, which is based on Ubuntu 16.04 LTS.
# Install OpenJDK-8
RUN apt-get update && \
apt-get install -y openjdk-8-jdk && \
apt-get install -y ant && \
apt-get clean;
# Fix certificate issues
RUN apt-get update && \
apt-get install ca-certificates-java && \
apt-get clean && \
update-ca-certificates -f;
# Setup JAVA_HOME -- useful for docker commandline
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
RUN export JAVA_HOME
To install OpenJDK 7 instead, you may need to prepend
add-apt-repository ppa:openjdk-r/ppa
such that the first step becomes
# Install OpenJDK-7
RUN add-apt-repository ppa:openjdk-r/ppa && \
apt-get update && \
apt-get install -y openjdk-7-jdk && \
apt-get install -y ant && \
apt-get clean;
I was able to install Java-11 on an image using Ubuntu 18.04. I also just needed it for only one application. (The Python wrapper around Apache Tika.)
FROM python:3.8.2-buster
COPY . /usr/src/app
# Install OpenJDK-11
RUN apt-get update && \
apt-get install -y openjdk-11-jre-headless && \
apt-get clean;
# Install PYTHON requirements
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# START WEBAPP SERVICE
CMD [ "python", "/usr/src/app/main.py" ]
Hope that helps.
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
For "Amazon Linux 2003" AMI, you can use the following command:
sudo dnf install java-11-amazon-corretto -y
For "Amazon Linux 2" AMI, use
sudo amazon-linux-extras install java-openjdk11 -y
If you're using Amazon linux 2, Use this
sudo amazon-linux-extras install java-openjdk11
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.
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!