How to choose a JDK for a given Ubuntu VM
If you are unsure of your system architecture, you can use the uname -m
or arch
command from a terminal. If you get x86_64 -> It's a x64.
You can refer to this answer for more details.
On a side note, as you have probably noticed, AdoptOpenJDK has transitioned to Eclipse and https://adoptopenjdk.net won't be updated as of July 2021. The new website is https://adoptium.net, and the distribution name is now "Temurin". That said, if you specifically need a 265 build, Adoptium does not provide it and you better stick with AdoptOpenJDK.
I think you may have a X-Y problem, namely that all you really want is a JVM for your system.
tl;dr
sudo apt install default-jdk
As suggested by running java
on a Ubuntu 20.04 LTS WSL instance:
tra@Thunder:~$ java
Command 'java' not found, but can be installed with:
sudo apt install openjdk-11-jre-headless # version 11.0.11+9-0ubuntu2~20.04, or
sudo apt install default-jre # version 2:1.11-72
sudo apt install openjdk-16-jre-headless # version 16.0.1+9-1~20.04
sudo apt install openjdk-8-jre-headless # version 8u292-b10-0ubuntu1~20.04
sudo apt install openjdk-13-jre-headless # version 13.0.7+5-0ubuntu1~20.04
sudo apt install openjdk-17-jre-headless # version 17+35-1~20.04
In other words, you have several already available in the Ubuntu package system. Note that if you actually need to compile programs, you need more like the javac
Java compiler.
tra@Thunder:~$ javac
Command 'javac' not found, but can be installed with:
sudo apt install openjdk-11-jdk-headless # version 11.0.11+9-0ubuntu2~20.04, or
sudo apt install default-jdk # version 2:1.11-72
sudo apt install openjdk-16-jdk-headless # version 16.0.1+9-1~20.04
sudo apt install openjdk-8-jdk-headless # version 8u292-b10-0ubuntu1~20.04
sudo apt install openjdk-13-jdk-headless # version 13.0.7+5-0ubuntu1~20.04
sudo apt install openjdk-17-jdk-headless # version 17+35-1~20.04
sudo apt install ecj # version 3.16.0-1
Unnless you have very specific requirements there are very good odds that the default-jdk
will do what you need.
sudo apt install default-jdk
(answer Yes, and watch the downloads pass by)
Then
tra@Thunder:~$ javac --version
javac 11.0.11
tra@Thunder:~$ java --version
openjdk 11.0.11 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)