Chapter 3. Major differences between Red Hat build of OpenJDK 11 and Red Hat build of OpenJDK 17 If you are migrating your Java applications from Red Hat build of OpenJDK 11 or earlier, first ensure that you familiarize yourself with the changes that were introduced in Red Hat build of OpenJDK 17. These changes might require that you reconfigure your existing Red Hat build of OpenJDK installation before you migrate to Red Hat build of OpenJDK 21. Note This chapter is relevant only if you currently use Red Hat build of OpenJDK 11 or earlier. You can ignore this chapter if you already use Red Hat build of OpenJDK 17. 3.1. Removal of Concurrent Mark Sweep garbage collector Red Hat build of OpenJDK 17 no longer includes the Concurrent Mark Sweep (CMS) garbage collector, which was commonly used in earlier releases for workloads sensitive to pause times and latency. If you have been using the CMS collector, switch to one of the following collectors based on your workload before migrating to Red Hat build of OpenJDK 17 or later. The Garbage-First (G1) collector balances performance and latency. G1 is a generational collector that offers a high ephemeral object allocation rate with typical pause times of a few hundred milliseconds. G1 is enabled by default, but you can manually enable this collector by setting the -XX:+UseG1GC JVM option. The Shenandoah collector is a low-latency collector with typical pause times of a few milliseconds. Shenandoah is not a generational collector and might exhibit worse ephemeral object allocation rates than the G1 collector. If you want to enable the Shenandoah collector, set the -XX:+UseShenandoahGC JVM option. The Z Garbage Collector (ZGC) is another low-latency collector. Unlike the Shenandoah collector, ZGC does not support compressed ordinary object pointers (OOPs) (that is, heap references). Compressed OOPs help to save heap memory and improve performance for heap sizes up to 32 GB. This means that ZGC might exhibit worse resident memory sizes than the Shenandoah collector, especially on small heap sizes. If you want to enable the ZGC collector, set the -XX:+UseZGC JVM option. For more information, see JEP 363: Remove the Concurrent Mark Sweep (CMS) Garbage Collector . 3.2. Removal of pack200 tools and API Red Hat build of OpenJDK 17 no longer includes any of the following features: The pack200 tool The unpack200 tool The java.util.jar.Pack200 API The java.util.jar.Pack200.Packer API The java.util.jar.Pack200.Unpacker API The use of these tools and APIs has been limited since the introduction of the JMOD module format in OpenJDK 9. For more information, see JEP 367: Remove the Pack200 Tools and API . 3.3. Removal of Nashorn JavaScript engine Red Hat build of OpenJDK 17 no longer includes any of the following features: The Nashorn JavaScript engine The jjs command-line tool The jdk.scripting.nashorn module The jdk.scripting.nashorn.shell module The scripting API, javax.script , is still available in Red Hat build of OpenJDK 17 or later. Similar to releases before OpenJDK 8, you can use the javax.script API with a JavaScript engine of your choice, such as Rhino or the now externally maintained Nashorn JavaScript engine. For more information, see JEP 372: Remove the Nashorn JavaScript Engine . 3.4. Strong encapsulation of JDK internal elements Red Hat build of OpenJDK 17 introduces strong encapsulation of all internal elements of the JDK, apart from critical internal APIs such as sun.misc.Unsafe . From Red Hat build of OpenJDK 17 onward, you cannot relax the strong encapsulation of internal elements by using a single command-line option. This means that Red Hat build of OpenJDK 17 and later versions prevent reflective access to JDK internal types apart from critical internal APIs. For more information, see JEP 403: Strongly Encapsulate JDK Internals . 3.5. Biased locking disabled by default Red Hat build of OpenJDK 17 disables biased locking by default. In Red Hat build of OpenJDK 17, you can enable biased locking by setting the -XX:+UseBiasedLocking JVM option at startup. However, the -XX:+UseBiasedLocking option is deprecated in Red Hat build of OpenJDK 17 and planned for removal in OpenJDK 18. For more information, see JEP 374: Deprecate and Disable Biased Locking . 3.6. Removal of RMI activation Red Hat build of OpenJDK 17 removes the java.rmi.activation package and its associated rmid activation daemon for Java remote method invocation (RMI). Other RMI features are still available in Red Hat build of OpenJDK 17 and later versions. For more information, see JEP 407: Remove RMI Activation . 3.7. Removal of the Graal compiler Red Hat build of OpenJDK 17 removes the Graal compiler, which comprises the jaotc tool and the jdk.internal.vm.compiler and jdk.internal.vm.compiler.management modules. From Red Hat build of OpenJDK 17 onward, if you want to use ahead-of-time (AOT) compilation, you can use GraalVM. For more information, see JEP 410: Remove the Experimental AOT and JIT Compiler . 3.8. Additional resources (or steps) OpenJDK: JEPs in JDK 17 integrated since JDK 11 Major differences between Red Hat build of OpenJDK 17 and Red Hat build of OpenJDK 21

Commands: