In my experience most libraries support ‘at least jdk8’ while making sure they also work fine with later versions. I don’t think it is all that commonly the case that software does not run on later versions (though indeed it happens, and IMHO those are bugs worth fixing).
Well, the module system is optional and for many libraries there just isn’t that much motivation to support it.
I’m not sure, I rather like the approach of “latest release by default, specify a particular version if you have special requirements”.
I added https://github.com/NixOS/nixpkgs/pull/98383 so it is easy to generate bespoke jlink’ed JRE’s that are ‘minimal’ for your use case. However, I think in nixpkgs we should still just depend on the ‘full’ JRE. The reason is when you have one tool that needs modules A+B, one that needs modules B+C, and one that only needs module A, you don’t want to install 3 JRE’s - you just want one JRE with A+B+C. So having a JRE with all modules enabled, and an easy way to replace it with a bespoke jlink’ed one (like we have right now) seems like the best solution to me.
If we really want to make tools lean, we should compile them into a native image with graal/substratevm instead.
Almost all software will specify
-release 8 (or
-target 1.8, though that is not entirely safe) in their build to target JDK8, so they produce jars that require only Java8 to run (even when built with a newer JDK).