Software Development Community Question

How do I transition from Java 8 to Java 17/21 effectively for a legacy monolith?

Posted on 2025-09-20 • In Software Development • By Karen Scott

We’ve been stuck on Java 8 for years, and the tech debt is starting to hurt our recruitment and performance. We want to jump straight to Java 21 (LTS). What are the biggest breaking changes we should prepare for regarding the module system (Jigsaw) and removed APIs like JAXB that used to be in the JDK?

3 Answers 14,283 Views

All answers to this question 3 Answers

Betty Adams Answered on 2025-01-12
Answered

Moving from 8 to 21 is a huge leap but definitely worth it for the performance alone. The biggest shock will be the removal of the "Java EE" modules (JAXB, JTA, etc.) from the JDK. You now have to include these as explicit Maven/Gradle dependencies using the jakarta.* coordinates. Regarding the module system, you don't actually have to modularize your own code; you can keep everything on the "unnamed module" (classpath), but you will likely run into "InaccessibleObjectException" due to stronger encapsulation. You'll need to use the --add-opens JVM flag to allow libraries like Spring or Hibernate to access internal JDK fields until those libraries are updated.

Charles Green Answered on 2025-03-05
Answered

Did you find that any specific third-party libraries became totally incompatible during the jump? We use some very old XML processing jars and I'm scared they'll break.

Anthony Baker Commented on 2025-03-25
Commented

Charles, old XML libraries are a common pain point. Many of them rely on internal Sun/Oracle classes that are now completely hidden or removed. Before you migrate, run the jdeps tool on your jars; it will tell you exactly which internal APIs your dependencies are using. In our case, we had to find modern alternatives for three different libraries because the originals hadn't been updated since 2015 and simply wouldn't start on Java 17+. It’s a good time to audit your dependency tree and remove the "zombie" libraries that are no longer maintained.

Helen Nelson Answered on 2025-04-10
Answered

Don't forget to update your build tools first! Old versions of Maven or Gradle won't even recognize the Java 21 bytecode or the newer compiler flags.

Karen Scott Commented on 2025-04-15
Commented

Spot on, Helen. We had to upgrade to Gradle 8.x before we could even attempt a successful compile. It's the first step in the whole process.

Write a Comment

Your email address will not be published. Required fields are marked (*)

Join the LearnersEra Community

Ask questions, share knowledge and learn from professionals across technology, project management and certification topics.

Change Country and Nearest City

Select your country and nearest city to see courses available in your region.