[Looking for Charlie's main web site?]

Beware that latest Oracle JDK installers will REMOVE older JDK installs of that version

Here's something new to beware, a change in the most recent Oracle JDK installers for Java 11 or 17 (since Jan 2023) which could break your apps which rely on Java, whether on Windows, macOS, or via RPM, where the new Oracle jdk installer WILL REMOVE any previous updates of that JVM version that were created by previous JDK installers of that same major version. And it will do pretty much without warning, which may be a confusing shock for those caught unaware. Let me explain.

TLDR; If you run the Oracle JDK installer for Java 11 or 17 after updates 11.0.18 or 17.0.6 or later (on any OS), it has two new behaviors:

  1. it will remove any prior update installed with the installer that major version, and it may or may not tell you that it does it (and any app relying on that old version/configured to use it specifically may not be able to restart/start)
  2. it will create a new folder to hold the new JVM with a name that only reflects the MAJOR version, like jdk-11, whereas previously the foldername also reflected the minor version, like jdk-11.0.17. You must change any app configured specifically to use such a specific Java version to use this new folder. Or you can instead manually extract the new JDK from the zip or tar.gz and place it where you like, configuring your app to point to that (some folks have always done this. This post is for those who have instead always used the installer.)

To be clear I'm referring here to new behavior in the JDK installers from the Jan 2023 update, which I blogged about the day they came out. This topic will apply also to subsequent JVM updates as they come out in the future. (Fortunately for some, this issue does NOT affect those running Java 8 or below--though I learned in Apr 2024 IT DID change also for Java 8 installers since July 2023. See more below. And this aspect of it being a "change in behavior" will not affect Java 19 or above, as I explain later.)

After I posted this, I heard some people assert that "this is not new behavior: Java's always popped up and offered to remove old versions". Those folks are misunderstanding something: that was true of past JRE installers (like in Java 8 and earlier, which don't exist for Java 11), but it was never the case for Oracle JDK installers (even for Java 8, before Jul 2023). THAT's what's new about the JDK 11 and 17 installers as of Jan 2023, but it may surprise those who never saw a JDK installer do that, thus this post.

While the technotes for the new updates (which I point to in my post above) DO make mention of the issue I'm describing, I don't feel they do it in as obvious a manner as they might (it's not clear how it affects CURRENTLY installed earlier updates of JDK 11 or 17), and I've already helped some people dealing with the ramifications of the change. And of course it's all the MORE important to make sure this is made known to those who might NOT read the release notes.

I've also found that the JDK installer doesn't ALWAYS warn that there are running processes using the older JDK version that it's about to remove. And to be clear, it won't warn about applications that are NOT running but which are configured to try to use the older JDK version that would be removed.

Read on for:

Before going further, it may help to clarify that when I (or others) refer to a "major Java version", we are referring for example to Java 11 or 17 (or Java 8 or 19, and so on). And when we refer to a "minor" version, we mean an update to such a major version, such as 11.0.17 for Java 11. Previous JDK installers did allow us to run more than one minor version of a given major version, which could be an advantage. Newer ones no longer will.

The issue, in brief: JDK installers now implement a single minor version per major version, deleting older minor versions

In brief, the new behavior is that:

  • The new Oracle jdk installers for 11 and 17 now implement a single-minor-version-per-major-version policy, supporting only ONE minor version (update) being implemented at a time by that installer, for a given major version of Java 11 or 17
  • As such, the new JDK installer will attempt to REMOVE all previous minor versions/updates to that major Java version, which were installed by previously run jdk installers for that major version. (To be clear, it will NOT touch any Java that was implemented by you or some software, which put Java someplace the JDK installer doesn't know about)
  • The problem is that you may or may not expect that removal of the old version to happen (it's new behavior for Oracle JDK 11 and 17), and it may have a serious impact on existing apps that may be currently using or set to use such an earlier minor version--which this process would remove!

Let's make things more clear: say you already have in place two "minor" versions of the "major" version of Java 11, for example 11.0.16 and 11.0.11, which were implemented by the previous JDK installers for those versions. Upon running the Oracle JDK installer for the new 11.0.18 version (or future later versions), that new JDK installer will attempt to REMOVE BOTH those 11.0.16 and 11.0.11 installations first!

Again the same is true of the Java 17 jdk installer.

(As for Java 8 or below, Oracle did not opt to implement this change in Jan 2023. That has changed as of Jul 2023,as I learned in a helpful comment below from Chris on Apr 18 2024. See also my reply to him for still more. As for Java versions 19 and above, it ALREADY implements this change from its original version, released in Sep 2022.)

The implications of this changed behavior which may trip you up--and a solution

There are a couple of VERY important implications of this change in behavior or the Oracle JDK installer, including some things that may surprise you--and one that may really trip you up, with a solution I can offer:

  • The most important implication of course is that you may NOT expect the JDK installer to DO this removal of the older version/s at all. Now you've been warned
  • And you may well be warned by the new JDK installer about this, telling you that some running app is using an older JDK update to be removed, at least giving you a chance to realize what's happening--and you can even cancel the install if you want.
    • Even so, the way the installer reports "already running processes" may surprise you: it will report processes by process id. It will be up to you to use your OS tools to find what process each of those points to, so you can stop them. (And I was surprised on one machine that it listed over a dozen processes, even ones that did not involve Java.) Fortunately, the JDK installer offers a "retry" option, so you can check if it feels you've stopped enough processes. I did not have to stop ALL of those listed, after all.
  • Then again, you may have some application that's configured to use such an old JDK--but if that application is not running, then obviously you can't expect the installer to warn you about that, since it's looking for whether any currently running processes refer to it. That's bad enough.
    • But on 2 of 3 machines I tested on, where I DID have running processes that were using that JDK to be uninstalled, the new JDK installer did NOT offer me that warning about running processes using it. It just deleted it.
  • And the sinister problem about those last two points is that you (or colleagues) may not realize what's happened until hours or even DAYS AFTER the new JDK installer was run, deleting the prior ones, so your apps that were relying on the older JDK (which is now REMOVED) will simply not start the next time you try to run (or restart) them. And it's very likely no one experiencing THAT problem will connect the dots to this having been caused by the new JDK installation.

Fortunately, solving those last couple of problems is rather easy, at least once you understand that this is what happened.

Just change your app to refer to the NEW JVM location. (Good news: with the new approach, there will always be only ONE JDK location for a given major version.) On Windows, for instance, it will by default be C:\Program Files\Java\jdk-11, without any minor version number. Of course, in some apps it's your responsibility to escape those Windows slashes, as in C:\\Program Files\\Java\\jdk-11.

As for HOW to make that change in your app, there are so many ways to control that depending on your Java-based app as well as how it was installed, etc. I'm writing this post in a way that the information will make sense regardless of what Java app you may run. And since someone in your org already had to know to change your app to point to the OLD JDK location (the one deleted), I'll have to leave this as an exercise for the reader. (For my traditional audience of CF users, see my CF Update page with more for you.)

Again, my goal here has been to make you AWARE of the issue, so you can plan for and anticipate it.

Some closing considerations

Before wrapping up, there are just a couple of closing topics related to the above someone may wonder:

  • "You say this change of behavior was documented?"": Yes. In the release notes for 11.0.18 and for 17.0.6, notice that each has 3 sections with different names ("Disable Side-by-Side Installations of Multiple JDK Updates in Windows JDK Installers", "All JDK Update Releases Are Installed Into the Same Directory on macOS", and "RPM JDK Installer Changes"), which cover essentially this one issue, each with slightly different details.
  • "Can't we just re-install the older JDK, if we want it back?": The answer is "yes", in that I was able to do that with the Windows 11.0.17 JDK, for instance. But note first that the next time you run any JDK installer from Jan 2023 or later, that will again remove it. Note also that the aforementioned release notes imply that future installers will PREVENT older JDK installers from running (perhaps only those from Jan 2023, forward.)
  • "What about openjdk and other non-Oracle Java implementations?": As I've indicated throughout this post, I'm talking about the Oracle JDK. Some alternative Java implementations ALREADY take this single-minor-version-per-major-version approach, such as the Azul Zulu JDK installer, as I confirmed with their JDK installer and docs for the JDK 11 version prior to this one, 11.0.17.
  • "You mention RPM installers. What about .deb files?": While the release notes refer to .rpm files, they make no mention of .deb files--though those are indeed offered as another Linux installer choice, for Debian/Ubuntu. I can confirm that when I ran the older 11.0.17 JDK installer as a .deb file, it installed into a single /usr/lib/jvm/jdk-11/ folder, reflecting the single-minor-version-per-major-version policy being already implemented BEFORE this 11.0.18 update.
  • "Does this affect Oracle JRE installers?": Oracle no longer offers separate JRE installers since Java 8. And as I noted earlier, this matter applies only to JDK 11 and 17 installers.

Conclusion

While this new behavior is challenging (all the more because it's new to the Oracle JDK), in time people will come to understand it and deal with it. Until then, I offer all this to help folks and give a heads-up.

If you may feel stuck, I can probably help quickly via my short-term, remote consulting.

As for all the above, I certainly welcome feedback.

For more content like this from Charlie Arehart: Need more help with problems?
  • If you may prefer direct help, rather than digging around here/elsewhere or via comments, he can help via his online consulting services
  • See that page for more on how he can help a) over the web, safely and securely, b) usually very quickly, c) teaching you along the way, and d) with satisfaction guaranteed
Comments
Thank you Charlie. One other point that people should be aware of. Once the JDK installer removes the minor releases, uninstalling the current minor release will only remove that release. It will not restore the minor releases that were removed during the install of the current release. Hopefully people will expect that but better said than not.
# Posted By Jeff Horne | 1/24/23 8:05 AM
Interesting thought, Jeff. And while some may think I go too far in my projection of possibilities and addressing them "ahead of time" in my writing, that's one that indeed never crossed my mind. :-)

But sure, people can have all kinds of expectations, so thanks for heading off that one.
Good to know Charlie, thank you for pointing this out! I always prefer the zip / tar.gz option anyways this enforces that preference further.
Yep, and as for which option may be "better" that will indeed vary among people, orgs, and deployments. Some may have tended to favor the installer for whatever reason, or mere habit. And some may well want to reconsider that choice, while still others may appreciate the change. :-)

In any case, at least with the heads-up, I hope more people can be prepared. :-)
Thanks Charlie, I had noticed this in a local installation (always test your process before updating the JDK in production!). Glad to hear the ZIP version won't delete the older one; I'll use that from now on.
Yep, Tim. Pros and cons to the different options. Nice to have choices.
Hi there, Charlie -

Am I to understand that installing the latest Java 17 SDK will /remove/ installations of Java 8, Java 11, etc?
I work in digital archiving and cannot randomly lose access to older versions of Java! I am so so so so tired of this. So it goes.

I would love to hear in simple terms if this removes current installations. Please help.
# Posted By anonymous | 1/4/24 6:33 AM
To @anonymous, the answer is no (the JVM installer for Java 17 will not remove installs of Java 8 or 11). I understand why you might have the question, but please note how I tried to clarify that/avoid confusion about it in the title ("Beware that latest Oracle JDK installers will REMOVE older JDK installs of that version"). Note I said "that version".

I elaborated still further in the first paragraph, that "the new Oracle jdk installer WILL REMOVE any previous updates of that JVM version that were created by previous JDK installers of that same major version". Again, note "that version".

I even repeated it in the first tldr bullet point, and still later. :-) I really tried to avoid confusion on that point, so it's sad to find somehow it was not enough. But sincere intent can be lost in a sea of words. I hope if anyone else may have the question, this response to you should help.

To be clear, the recent change in JVM installers (discussed here) will NOT cause them to remove older installs of OTHER versions of the JVM, only other installs of THAT version (and even then only those that were implemented using the JVM installer for that version--not those implemented using the JVM's available "zip" install option.)

But let me know if you think I should offer some more specific phrase in the text. I ask that sincerely.
As of build 381 of JDK 8 with the exe or MSI will act the same way and remove older versions.
# Posted By eric | 4/18/24 12:08 PM
Eric, thanks so much. I'd indeed missed that news, which is first partly because I find few people still running Java 8 (who are also keeping it updated). Good for you! :-)

But second, even someone who read the technote for the update (as I did, when that update came out in July 2023) could be forgiven for not noticing news of this change. It's only mentioned in passing way down the note--and indicated in dealing with a possible error that could result, as if they felt folks already knew the change would be happening in that update ("the July 2023 CPU" as it refers to itself) at:
https://www.oracle.c...

Without more info there, it's also unclear if that was a change only for the Windows installer or also Linux and MacOS. Anyone know yet?

I'll add that I searched that technote page for all references to "install" (there were over 30),but this was the only one suggesting this change in behavior. That sure seems odd.

So again, thanks. I'll tweak the post to mention this, and I'll point to these comments for more news that may come along.
Copyright ©2024 Charlie Arehart
Carehart Logo
BlogCFC was created by Raymond Camden. This blog is running version 5.005.
(Want to validate the html in this page?)

Managed Hosting Services provided by
Managed Dedicated Hosting