1

I am attempting to install OpenJDK on my headless server running Ubuntu 20.04. I've done this before on older versions of Ubuntu, but as it had been a while since then, I couldn't remember the package name. I put in the java command so that I could find the correct package name, and I received this:

Command 'java' not found, but can be installed with:

sudo apt install default-jre              # version 2:1.11-72, or
sudo apt install openjdk-11-jre-headless  # version 11.0.7+10-3ubuntu1
sudo apt install openjdk-8-jre-headless   # version 8u252-b09-1ubuntu1

I wanted OpenJDK 8, so I put in sudo apt install openjdk-8-jre-headless and hit enter, expecting it to be installed. Instead, I received this:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package openjdk-8-headless

I don't understand why the package can't be located. I've done everything I can think of, and I can't seem to find anyone else having this problem, so any help would be greatly appreciated. Thanks for your time!

1 Answers1

5

You made a typo: the error message says that it can't find openjdk-8-headless.

But the correct package name is openjdk-8-jre-headless. It is available and installs without any issues on 20.04.

Pilot6
  • 90,100
  • 91
  • 213
  • 324