Install exact version of OpenJDK

10,542

You can use aptitude and the following command:

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

During the process, Aptitude will ask to choose one of the variants to resolve this problem and it's needed to choose an installation of the previous version of the openjdk-8-jre-headless package in this case.

Or you can manually install the previous version of the packages:

sudo apt install openjdk-8-jre-headless=8u144-b01-2
sudo apt install openjdk-8-jdk-headless=8u144-b01-2
Share:
10,542

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    Ubuntu 17.10 (GNU/Linux 4.13.0-16-generic x86_64)

    After installing java with the command:

    sudo apt install openjdk-8-jdk-headless
    

    I have java version 8u151

    But because of the bug (https://bugs.openjdk.java.net/browse/JDK-8189789) I need to install the previous update of Java 8 u144 or u131 whatever.

    To see available versions:

    $ 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
    

    And when I try to install

    $ 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.
    

    Here I stucked.

    The question: How to install exact update of OpenJDK 8?

  • angelito
    angelito almost 4 years
    Run apt list -a openjdk-8-jdk-headless before to see the available versions. On Ubuntu 20.04, aptitude is not installed by default so use the second option.
  • angelito
    angelito almost 4 years
    also do not forget to execute `sudo apt-mark hold ... on these packages. See askubuntu.com/questions/18654/…