0

I am using Linux Mint XFCE 20.

Recently I installed Java by running sudo apt-get install openjdk and it automatically installed versions 8 and 11 of both JRE and JDK, including JRE headless.

It turns out that I needed only openjdk 16 to run what I wanted to, and having other versions of java are kinda pointless. My main issue is that programs default to version 8 and I can't seem to fix it.

So how can I uninstall both versions 11 and 8 and just keep 16?

2 Answers 2

1

The unwanted versions can be removed by name:

sudo apt remove openjdk-8-jdk
sudo apt remove openjdk-11-jdk

They are installed with different packages.

You can see all the openjdk packages available with this command:

sudo apt update
apt-cache search openjdk

You can see all openjdk packages in your system with:

dpkg -l | grep openjdk

Note: I am a RedHat user, not a Mint expert but this is pretty much the same on every distro. I just checked the package names on Mint for those commands to work.

0

With the provided instructions I was able to uninstall everything I don't need. I also had to uninstall headless versions separately with commands:

sudo apt remove openjdk-8-jre-headless
sudo apt remove openjdk-11-jre-headless
1
  • This is not quite how these sites work, these aren't discussion forums but Q&A sites. Please take the Tour and check out Questions and Answers in the Help section to learn how they differ. To say "thanks" you just need to accept the answer. Don't be surprised if this gets deleted - this is more a comment than an actual answer to your question, and commenting in an answer isn't allowed. From Review Oct 3, 2021 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.