How to install openjdk-8-jdk on Debian 10 (Buster)?

It seems Debian does not support openjdk-8-jdk anymore due to a security issue. What is the easiest way to install openjdk-8-jdk for Debian 10 (Buster)?


Solution 1:

Alternatively, you can use adoptopenjdk repository:

wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -

sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/

sudo apt-get update && sudo apt-get install adoptopenjdk-8-hotspot

https://adoptopenjdk.net/installation.html

Solution 2:

WARNING: this answer suggest unsupported and dangerous mixing of Debian releases. Follow the advice on your own risk, as it can break the system on upgrades, as explained in http://wiki.debian.org/DontBreakDebian#Don.27t_make_a_FrankenDebian

Package mirror search steps:

  1. In the Search package directories search for openjdk-8-jdk. You can see two results:

    • stretch (oldstable) (java): OpenJDK Development Kit (JDK)
    • sid (unstable) (java): OpenJDK Development Kit (JDK)
  2. Choose stretch repository

  3. Scroll to the Download openjdk-8-jdk section and choose your architecture. For example amd64

  4. Now you can see mirrors list and instructions how to install the package via apt:

    You should be able to use any of the listed mirrors by adding a line to your /etc/apt/sources.list like this:

    deb http://security.debian.org/debian-security stretch/updates main

Installation steps:

  1. Install software source manager

    apt-get update
    apt-get install software-properties-common
    
  2. Add mirror with openjdk-8-jdk

    apt-add-repository 'deb http://security.debian.org/debian-security stretch/updates main'
    apt-get update
    
  3. Install openjdk 8

    apt-get install openjdk-8-jdk
    

Note: You can use steps above to find an official Debian mirror with any other package you want to install