#
Setup Java 8
Install the required packages
apt install apt-transport-https ca-certificates wget dirmngr gnupg software-properties-common -y
Add the public key of the repository
wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | apt-key add - && add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
Update the packages of your server
apt update
Install Java8
apt install adoptopenjdk-8-hotspot -y
To verify the setup run this command
java -version
Sample Output
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.292-b10, mixed mode)