安装确切版本的 OpenJDK

安装确切版本的 OpenJDK

Ubuntu 17.10(GNU/Linux 4.13.0-16-通用 x86_64)

使用以下命令安装 java 后:

sudo apt install openjdk-8-jdk-headless

我有 Java 版本 8u151

但由于这个 bug(https://bugs.openjdk.java.net/browse/JDK-8189789) 我需要安装 Java 8 u144 或 u131 的先前更新。

查看可用版本:

$ apt-cache policy openjdk-8-jdk-headless
openjdk-8-jdk-headless:
  Installed: (none)
  Candidate: 8u151-b12-0ubuntu0.17.10.2
  Version table:
     8u151-b12-0ubuntu0.17.10.2 500
        500 http://us.archive.ubuntu.com/ubuntu artful-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu artful-security/main amd64 Packages
     8u144-b01-2 500
        500 http://us.archive.ubuntu.com/ubuntu artful/main amd64 Packages

当我尝试安装时

$ sudo apt install  openjdk-8-jdk-headless=8u144-b01-2
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 openjdk-8-jdk-headless : Depends: openjdk-8-jre-headless (= 8u144-b01-2) but 8u151-b12-0ubuntu0.17.10.2 is to be installed
E: Unable to correct problems, you have held broken packages.

我在这里陷入了困境。

问题:如何安装 OpenJDK 8 的精确更新?

答案1

您可以使用aptitude以下命令:

sudo aptitude install openjdk-8-jdk-headless=8u144-b01-2

openjdk-8-jre-headless在此过程中,Aptitude 会要求选择其中一个变体来解决此问题,在这种情况下,需要选择安装该软件包的先前版本。

或者您可以手动安装以前版本的软件包:

sudo apt install openjdk-8-jre-headless=8u144-b01-2
sudo apt install openjdk-8-jdk-headless=8u144-b01-2

相关内容