0

I'm trying to run a Java program and I'm getting the error "xxx has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0"

However, I have already installed jdk 16.0.2 which I believe should give me the updated version, which means I need to remove my old Java, my question is, how do I figure out which package is my old Java so I can remove it?

Eduardo Wada
  • 103
  • 1
  • 3
  • Your title seems to be asking about Finding out what package a command came from but I suspect that's not the real issue here – steeldriver Jan 26 '23 at 13:03
  • @steeldriver you are correct, the reason I asked about where it comes from is because I know how to fix the real issue from there by uninstalling the package and installing the correct package, DynamicBits answer on keeping two simultaneous versions does help me though and the reason I didn't accept it is simply because I didn't test it yet, and the link you provided gives exactly what I was originally looking for. – Eduardo Wada Jan 26 '23 at 13:56

1 Answers1

0

You can keep multiple versions installed, but choose which version is the default with the following command:

sudo update-alternatives --config java

To easily verify which version is default, run java --version.

To list all of the installed jdk packages, run apt list --installed "*jdk*".

DynamicBits
  • 453
  • 2
  • 8
  • the sudo update-alternatives --config java actually just didn't work for me, it doesn't detect any other alternative, the apt list --installed "*jdk*" was enough for me to figure it out though – Eduardo Wada Jan 26 '23 at 19:58