Install Openjdk1.8.0 In Ubuntu Code Example

Snippet 1
  # If you want java 11:
sudo apt install default-jre

# If you want java 8:
sudo apt update
sudo apt install apt-transport-https ca-certificates wget dirmngr gnupg software-properties-common
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 update
sudo apt install adoptopenjdk-8-hotspot 
Snippet 2
  
sudo apt-get update
sudo apt-get install oracle-java11-installer-local