

You will need to replace ‘ IP_Address‘ and ‘Port_number‘ with your server’s respective IP address and SSH port number. Log in to the Server & Update the Server OS Packagesįirst, log in to your Ubuntu 20.04 server via SSH as the root user: ssh -p Port_number

So in my case, the path I would use in the next command is /usr/lib/jvm/java-1.16.0-openjdk-amd64. Install your desired jdk or jre chosen from the search list: sudo apt install openjdk-whatever-versionĬheck the java alternatives list to get the path to your new java version: update-java-alternatives -list You’re looking for something in the list that looks like openjdk-version-jdk or openjdk-version-jre.

In this scenario, you have already installed “default-jdk” or “default-jre” (which is version 11 on Ubuntu 20.04) and have a working Java installation, and now you want to use a different java version (in my case, I wanted version 16).įirst find the java version you want to use: apt-cache search openjdk I’m doing this on Ubuntu 20.04 but it should work on any modern-ish Ubuntu or other Debian Linux.
