TL;DR: Execute highlighted commands to install Java 8 on Debian 10+.
Debian 10 and higher (e.g. Buster or Bullseye) no longer provide Java 8. However certain software, including Sonatype Nexus, still is not compatible with versions higher than 8. In this past it was easy to install AdoptOpenJDK. However now that AdoptOpenJDK has moved to the Eclipse Foundation1 and is called Adoptium, providing a distribution called Eclipse Temurin, it no longer (officially) supports Debian.
Available alternatives include Debian’s nvidia-openjdk-8-jre, which only provides a JRE, Amazon Corretto, which support Debian, but whose installation instructions are Ubuntu specific and don’t work on Debian, and Azul Zulu, whose instructions require trusting a signing key downloaded over an insecure connection. None of these options appeal to me.
So here is how to install Azul Zulu without using insecure connections.
First download the signing key and add it to the apt keychain:
wget -O- https://www.azul.com/wp-content/uploads/2021/05/0xB1998361219BD9C9.txt | sudo apt-key add -
Add the Azul repository:
echo 'deb [ arch=amd64,arm64 ] https://repos.azul.com/zulu/deb/ stable main' > /etc/apt/sources.list.d/zulu-openjdk.list
And install JDK 8:
apt install zulu8-jdk
That’s it. You should be good until support ends in December of 2030.