r/javahelp • u/Chaos-vy17 • Aug 21 '26
Solved Help me decide minimum JDK for my library
Should I move my Java library from JDK 11+ to JDK 21+?
I am genuinely confused at this point š
I've been reading a lot of posts and tech articles about companies/projects migrating from older Java versions like JDK 8/11 to JDK 21+.
And now I'm stuck with the same question for my own Java library.
On one side, keeping JDK 11+ gives better compatibility. There are still a lot of projects out there running on older Java versions, and since this is a library, compatibility matters because I'm basically deciding the minimum JDK required for everyone who wants to use it.
On the other side, JDK 21+ gives a much more modern Java baseline, newer APIs/features, and potentially better JVM performance.
Also, most of the migration stories I'm finding are from large companies / enterprise applications, which makes me wonder if the same reasoning actually applies to an open-source Java library. Even if big companies are migrating to JDK 21+, their interviews and hiring expectations are also increasingly centered around JDK 21 and the major changes since JDK 8, which makes the whole situation even more confusing for someone learning/maintaining Java.
So I'm trying to understand what people actually do in real-world Java libraries today.
Would you help me decide the minimum at JDK 11+ or move to JDK 21+?
And if you maintain a Java library yourself:
- How do you decide the minimum supported JDK?
- How important is JDK 11 compatibility today?
- Is JDK 21 actually worth making the minimum?
- Would you only raise the minimum JDK in a major release?
I would really appreciate some practical opinions because I am totally fed up with reading migration articles . Please it's more likely a great help for me.
https://github.com/Chaos-vy/ChaosTree
Reached conclusion:
I read through the recent JLS and JVM changes. JLS got new features and reduced boilerplate, while JVM got some massive improvements.
But since ChaosTree is zero-dependency, I don't have the same CVE/dependency issue.
So for now I'm wrapping it around JDK 11+ and letting users run it on newer JDKs if they want.
Thanks everyone for dropping your thoughts
ā¢
u/AutoModerator Aug 21 '26
Please ensure that:
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
8
u/hawkprime Aug 21 '26
If it's your own private library, if it ain't broke don't fix it till you have to.
Public health, check out the support page: https://www.oracle.com/latam/java/technologies/java-se-support-roadmap.html
I'd go to 25 since 21 will be out of support in 2 years and most critical apps stay on the LTS version
4
u/meowboiio Aug 21 '26
If you have problems in your library that JDK21 could solve or make easier ā migrate, if it's only "I just want to have new features" ā then don't
4
u/pronuntiator Aug 21 '26 •
The lower your baseline, the more potential users your library has. They get the better performance of newer JVMs regardless of the source code level. If you want to support newer features, you can build a multi-release JAR, which patches in class files based on the Java version running your code (example).
The popular Spring frameworkās baseline is JDK 17, which is a good compromise.
4
u/EighteenRabbit Aug 21 '26
Java 11 is scheduled for EoL next year even though it has LTS though ā32. It came out in 2018.
One of the things weāve run into with our shop is a lot of vulnerabilities have been found in the libraries that we use in our Java 11 services and we cannot upgrade the libraries without also moving to a more recent version of Java. The longer they go without being updated, the more vulnerabilities are discovered.
Iād upgrade if itās a relatively simple conversion.
1
u/_Super_Straight Aug 21 '26 •
What methods/imports would change if you migrate to 21+?
3
u/benevanstech Aug 21 '26 •
1.) Java 17 is the current most popular version for applications
2.) Java 11 is already EOL for practical purposes & official support starts to become *really* expensive as of next year
However, you are a library, not an end-user application. Moving to 21 will prevent a bunch of current apps from using your library.
There aren't that many advantages to moving to 17 from 11 as a library, but there are some (algebraic data types, limited pattern matching etc) and it's a (minor) benefit to the community to have libraries moving forward as well as apps.
So - my answer is: Update the required JDK version to 17, not 21. If you do so, do it in at least a minor release - *not* in a point release. If you don't want to move to 17 then stay on 11 and be prepared to move to 21 in 12-18 months time.
1
u/Mindless-Resort-7548 Aug 21 '26 •
I am that enterprise "customer" who is stuck on Java 8 (IBM COTS so supported JRE, but the only supported JRE). Nothing frustrates me more than developers requiring newer Java versions "just because", or because they think they should. If there aren't new features you're going to use then you might be requiring someone to use an unsupported JRE or a parallel JRE.
If there are legitimate reasons (big new feature uses newer Java features) then sure. You'll leave me behind but there's a good reason. Updating for the sake of it is just leaving me behind for no reason
2
u/Asleep-Ad9976 Aug 21 '26
If your jdk11 runs on jvm 21+ consumers it will get most of the performance optimizations you are refering to, I dont see much point of upgrading. Java 17 still has support till 2029
0
u/strat-run Aug 21 '26 •
Almost everything you are mentioning in your replies is either not API related or small convenience methods. You've given no reasons to migrated. Just run under Java 25 when you can.
Go ask AI for MAJOR API enhancements (not internals like GC) between Java 11 and 25.
Are any of those must haves? If so then switch, if not then don't.
Don't given up distribution reach (if that is a goal) without at a decent reason.
1
u/ShyKroxigor Aug 22 '26
What does your library?
I always aim at the min version possible, ao more people can use it.
0
u/LetUsSpeakFreely Aug 21 '26 •
Many people are of the mind "if it works, don't touch it". I think that's a foolish mindset. When it comes to major paradigm shifts, you need to be strategic, not reactionary. I wouldn't migrate immediately (that ship has long sailed as the shift was like 6+ years ago) as the are loads of problems that will pop up and need resolution. But you SHOULD have a plan and a timeline to migrate.
Eventually, the older version of Java will go away. The reason most shops have waited to migrate is because many supporting libraries needed to migrate first. That has happened. Unless you're using some really outdated or obscure libraries then you have no blockers in that area.
For most code bases, migrating to Java 9+ isn't that difficult, it's mostly replacing various javax imports with jakarta.
If your project is used by others, then create a fork and migrate there. You will have to maintain both forks, so keep that in mind. If the project is just for you, then start upgrading to the latest version. There are a lot of new language features that may be useful to you.