Search code examples
javalinuxjava-8linux-mintwindows-subsystem-for-linux

WSL2 Linux Mint OpenJDK 8


I am running Linux Mint on WSL 2. I installed OpenJDK 8 from using sudo apt a while back. Running update-alternatives returns the following results.

 sudo update-alternatives --display java

java - auto mode
  link best version is /usr/lib/jvm/java-11-openjdk-amd64/bin/java
  link currently points to /usr/lib/jvm/java-11-openjdk-amd64/bin/java
  link java is /usr/bin/java
  slave java.1.gz is /usr/share/man/man1/java.1.gz
/usr/lib/jvm/java-11-openjdk-amd64/bin/java - priority 1111
  slave java.1.gz: /usr/lib/jvm/java-11-openjdk-amd64/man/man1/java.1.gz
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java - priority 1081
  slave java.1.gz: /usr/lib/jvm/java-8-openjdk-amd64/jre/man/man1/java.1.gz

Java 8 is point to the jre, but the entire SDK is installed. When I switch to java-8-openjdk-amd64, the java versions is 8, but the javac is java 11. If I perform an ls on /usr/lib/jvm/java-8-openjdk-amd64/bin directory, everything is there. Some of the entries are links to the jre which is fine. How do I switch it so update-alternatives points to the /usr/lib/jvm/java-8-openjdk-amd64/ directory not the /usr/lib/jvm/java-8-openjdk-amd64/jre directory.


Solution

  • Thank you for the comments. I ended up finding the answer myself by Googling multiple results. I uninstalled the openjdk-8 packages and installed the deb package for Zulu. I then called update-alternatives to add the java directory that is not the JRE. I probably didn't need to uninstall the openjdk-8 package, but I needed something in the Zulu java version.