When trying to install OpenJDK 11 in Ubuntu, I got an error

sudo apt-get install openjdk-11-jdk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package openjdk-11-jdk is a virtual package provided by:
  oracle-java13-installer 13.0.2-1~linuxuprising0
  oracle-java11-installer-local 11.0.6-1~linuxuprising0
You should explicitly select one to install.

E: Package 'openjdk-11-jdk' has no installation candidate

2 Answers 2


To install OpenJDK 11 in Ubuntu, use the commands listed below.

  1. Add the repository
sudo add-apt-repository ppa:openjdk-r/ppa
  1. Update package list
sudo apt-get update
  1. Install openjdk-11-jdk
sudo apt install openjdk-11-jdk
  • 2
    "apt-get install software-properties-common" for the add-apt-repository command.
    – Owl
    Commented Apr 17, 2020 at 11:58

I had this error while building a Dockerfile. The solution was to install default-jre instead:

sudo apt-get install -y default-jre

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .