当我尝试在 Ubuntu 中安装 OpenJDK 11 时,出现错误
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
答案1
要在 Ubuntu 中安装 OpenJDK 11,请使用下面列出的命令。
- 添加存储库
sudo add-apt-repository ppa:openjdk-r/ppa
- 更新包列表
sudo apt-get update
- 安装
openjdk-11-jdk
sudo apt install openjdk-11-jdk
答案2
我在构建时遇到此错误Dockerfile
。解决方案是安装default-jre
:
sudo apt-get install -y default-jre