Removed Java 18 to replace with 17 but still 18 when run.
Paul Smith
paul at mad-scientist.net
Wed Nov 23 06:05:36 UTC 2022
On Wed, 2022-11-23 at 15:16 +1100, Owen Thomas wrote:
> I did check "which java" I had installed before I installed the
> OpenJDK 18 package, and nothing was returned. I would have thought
> that removing the OpenJDK 18 package would have removed what was
> installed, but evidently not.
The problem is that there are two DIFFERENT packages.
There is the JRE (Java Runtime Environment) and the JDK (Java
Development Kit). The JRE is needed to run Java apps that someone else
created. The JDK is needed if you want to build Java apps on your
system.
You had installed both JRE 18 and JDK 18. The JDK requires the JRE,
but the JRE does not require the JDK. You uninstalled ONLY JDK 18,
that does not uninstall the JRE, since the JRE can perfectly well be
installed by itself without the JDK.
So, the JRE for release 18 was still present on your system.
> Removing these packages should have been a simple exercise. It was
> not. I have had more memorable days as a result.
It would have been simple, if you'd used the package manager to see
what was installed instead of relying on inaccurate things like the
"which" program.
To see which packages you have installed you should ask the package
manager; one way:
apt list --installed 'openjdk-18*'
will show all installed packages that match openjdk-18*.
Finally, note that there's no problem at all having multiple versions
of Java (JDK and JRE) installed at the same time. You can have many
versions installed, and choose which one you want to be the "default"
(the one that is invoked when you run "java") using the
"update-java-alternatives" script.
More information about the ubuntu-users
mailing list