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
sudo apt install default-jre
sudo apt install openjdk-16-jre-headless
sudo apt install openjdk-8-jre-headless
sudo apt install openjdk-13-jre-headless
sudo apt install openjdk-17-jre-headless
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
sudo apt install default-jdk
sudo apt install openjdk-16-jdk-headless
sudo apt install openjdk-8-jdk-headless
sudo apt install openjdk-13-jdk-headless
sudo apt install openjdk-17-jdk-headless
sudo apt install ecj
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)