Using Ubuntu
apt-get -y updateWait a while, this process may take 1-2 minutes. When finished, a prompt appears to enter commands on behalf of the user.

Use universal command to install OpenJDK 8
sudo apt install -y openjdk-8-jdkWaiting for all files to be downloaded and installed.

apt-get -y updateWait a while, this process may take 1-2 minutes. When finished, a prompt appears to enter commands on behalf of the user.

Use universal command to install OpenJDK 11
sudo apt install -y openjdk-11-jdkWaiting for all files to be downloaded and installed.

apt-get -y updateWait a while, this process may take 1-2 minutes. When finished, a prompt appears to enter commands on behalf of the user.

Use universal command to install OpenJDK 17
sudo apt install -y openjdk-17-jdkWaiting for all files to be downloaded and installed.

java -version
apt-get -y purge openjdk* java*Debian usage
apt install apt-transport-https gnupg wget software-properties-common -yWe’re adding a 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/apt-get updateInstalling OpenJDK 8.
apt-get install adoptopenjdk-8-hotspot -yapt-get -y updateWait a while, this process may take 1-2 minutes. When finished, a prompt appears to enter commands on behalf of the user.

Use universal command to install OpenJDK 11
apt-get install -y openjdk-11-jdkWaiting for all files to be downloaded and installed.

apt-get -y updateWait a while, this process may take 1-2 minutes. When finished, a prompt appears to enter commands on behalf of the user.

Use universal command to install OpenJDK 17
apt-get install -y openjdk-17-jdkWaiting for all files to be downloaded and installed.

java -version
apt-get -y purge openjdk* java*Last updated