How does Jakarta/Java EE compatibility work?

So I’m trying to understand which JDK versions are compatible with Jakarta EE 9.1 (using glassfish 6.1.0). Apparently it supports up to JDK 11 but in NetBeans in able to perfectly run GlassFish with JDK 16 installed. Also it shows that the installed Jakarta API libraries are of version 9.0.0 but somehow I’m still able to download, install and run GlassFish 6.1.0..

To put it simply, I’m just really confused with all the version compatibility and how can stuff work on my end without matching versions (under the assumption that what I wrote above is correct).

Answer

Some products work well with later versions of Java as well.

Java 8, 11, and 17 are the official Long-Term Support (LTS) versions. So these are the versions expected to be used in production for serious deployments.

The main point of Jakarta EE 9.1 is the support of Java 11. Some specs have other changes, but mostly minor.

Jakarta 10, under development now, is where you can expect to see innovations and improvements. You can find many video presentations and blog posts discussing possible changes and current plans. The various teams are asking for input from those with an interest in their particular spec.

You said:

able to perfectly run GlassFish with JDK 16 installed

Java 16 is now at end-of-life, no longer supported. I suggest you move on to Java 17, the current version, and also a LTS version.

Yes, many products will run well with later versions of Java. This is especially true of products compliant with Jakarta EE 9.1, aimed at supporting Java 11. Java had some issues with breaking or limiting backward compatibility between Java 8 and 11. So some older products may run into a problem when moving past Java 8. In contrast, compatibility from Java 11 through 17 has been very smooth with very few issues.

But that is the point of the six-month cadence of official Java releases. You can, and likely should, do some of your dev and testing work using each Java release. If you encounter any issues, you can provide feedback to the developers of the problematic product sooner rather than later.

Regarding Eclipse GlassFish specifically, their home page describes various releases.

  • Version 6.2.2 is the current release compliant with Jakarta EE 9.1.
    • Compiles with JDK 11 to JDK 17
    • Runs on JDK 11 to JDK 17.
    • Briefly tested with JDK 18 early-access releases.
  • The prior version, GlassFish 6.2.1, brought much improved support for JDK 17.