6 Compatibility challenges when moving to Java 9 or later
This chapter covers
- Why JEE modules are deprecated and not resolved by default
- Compiling and running code that depends on JEE modules
- Why casts to URLClassLoader fail
- Understanding the new JDK run-time image layout
- Replacing the removed extension mechanism, endorsed standards override mechanism, and boot class path option
This chapter and chapter 7 discuss compatibility challenges when migrating an existing code base to Java 9 and beyond. You won’t be creating any modules yet; these chapters are about building and running an existing project on the newest release.
Why does moving to Java 9+ require two entire chapters? Can’t you install the newest JDK and expect everything to just work? Isn’t Java meant to be backward-compatible? Yes—if your project, including its dependencies, only relies on nondeprecated, standardized, documented behavior. But that’s a big if, and it turns out that in the absence of any enforcement, the wider Java community has strayed from that path.
As you’ll see in this chapter, the module system deprecated some Java features, removed others, and changed some internals: