Before migrating your application to the latest JDK release, you must understand what the updates and changes are between it and the previous JDK release. If you are migrating from JDK 8, you should also be familiar with the differences between JDK 8 and later releases that are described inMigrating from JDK 8 to Later JDK Releases.
See the following sections to learn about some of the significant changes in JDK releases.
SeeJDK 23 Release Notes for additional descriptions of the new features and enhancements, and API specification in JDK 23.
The following are some of the updates in Java SE 23 and JDK 23:
Language Preview Features
instanceof andswitch operators, expressions, and statements work with all primitive types.SeeJEP 455: Primitive Types in Patterns, instanceof, and switch (Preview) and the following sections inJava Platform, Standard Edition Java Language Updates:
SeeJEP 476: Module Import Declarations (Preview) andModule Import Declarations inJava Platform, Standard Edition Java Language Updates.
SeeJEP 482: Flexible Constructor Bodies (Second Preview) andFlexible Constructor Bodies inJava Platform, Standard Edition Java Language Updates.
SeeJEP 477: Implicitly Declared Classes and Instance Main Methods (Third Preview) andImplicitly Declared Classes and Instance Main Methods inJava Platform, Standard Edition Java Language Updates.
SeeMarch 2024 Archives by thread andUpdate on String Templates (JEP 459) from the Project Amber amber-spec-experts mailing list for further discussion.
SeeJEP 12: Preview Features andPreview Language and VM Features inJava Platform, Standard Edition Java Language Updates.
Library Improvements Previews and Incubator
SeeJEP 466: Class-File API (Second Preview) andClass-File API inJava Platform, Standard Edition Java Virtual Machine Guide.
SeeJEP 473: Stream Gatherers (Second Preview) andStream Gatherers inJava Platform, Standard Edition Core Libraries.
SeeJEP 480: Structured Concurrency (Third Preview) andStructured Concurrency inJava Platform, Standard Edition Core Libraries.
SeeJEP 481: Scoped Values (Third Preview) and theScopedValue class in the Java API Specification.
Runtime Improvements
SeeJEP 474: ZGC: Generational Mode by Default and the sectionThe Z Garbage Collector inJava Platform, Standard Edition HotSpot Virtual Machine Garbage Collection Tuning Guide.
-XX:+UnlockExperimentalVMOptions -XX:+UseGraalJITIf you do not pass these flags at JVM startup, the Oracle JDK default JIT (C2) will run as usual.
Tooling
JavaDoc documentation comments can now be written in Markdown syntax along with HTML elements and JavaDoc tags.
SeeJEP 467: Markdown Documentation Comments andMarkdown in Documentation Comments inJava Platform, Standard Edition JavaDoc Guide.
Removed APIs, Tools, and Components
For more details on removals and deprecations, seeFeatures and Options Removed and Deprecated in JDK 23.
In addition, there are security related updates that you need to be aware of. SeeSecurity Updates in JDK 23.
SeeJDK 22 Release Notes for additional descriptions of the new features and enhancements, and API specification in JDK 22.
The following are some of the updates in Java SE 22 and JDK 22:
Language Features
(_).SeeJEP 456: Unnamed Variables & Patterns andUnnamed Variables and Patterns inJava Platform, Standard Edition Java Language Updates.
Preview Language Features
SeeJEP 447: Statements before super(...) andStatements Before super(...) inJava Platform, Standard Edition Java Language Updates.
SeeJEP 459: String Templates (Second Preview) andString Templates inJava Platform, Standard Edition Java Language Updates.
SeeJEP 463: Implicitly Declared Classes and Instance Main Methods (Second Preview) andImplicitly Declared Classes and Instance Main Methods inJava Platform, Standard Edition Java Language Updates.
SeePreview Language and VM Features for more information about preview features.
Library Improvements
SeeJEP 454: Foreign Function & Memory API andForeign Function and Memory API inJava Platform, Standard Edition Core Libraries.
Library Improvements Previews and Incubator
SeeJEP 461: Stream Gatherers (Preview) andStream Gatherers inJava Platform, Standard Edition Core Libraries.
SeeJEP 457: Class-File API (Preview) andClass-File API inJava Platform, Standard Edition Java Virtual Machine Guide.
SeeJEP 462: Structured Concurrency (Second Preview) andStructured Concurrency inJava Platform, Standard Edition Core Libraries.
SeeJEP 464: Scoped Values (Second Preview) and theScopedValue class in the Java API Specification.
SeeJEP 12: Preview Features andJEP 11: Incubator Modules for more information about preview features and incubating APIs.
Performance Improvements
Region pinning in G1 reduces latency so that garbage collection need not be disabled during Java Native Interface (JNI) critical regions.
SeeJEP 423: Region Pinning for G1 and the sectionEvacuation Failure inJava Platform, Standard Edition HotSpot Virtual Machine Garbage Collection Tuning Guide.
Tooling
The Java application launcher is enhanced to run a program supplied as multiple files of Java source code. This will enable gradual transition from small programs to larger ones.
Removed APIs, Tools, and Components
For more details on removals and deprecations, seeFeatures and Options Removed and Deprecated in JDK 22.
In addition, there are security related updates that you need to be aware of. SeeSecurity Updates in JDK 22.
SeeJDK 21 Release Notes for additional descriptions of the new features and enhancements, and API specification in JDK 21.
The following are some of the updates in Java SE 21 and JDK 21:
Language Features
for statement has been removed.SeeJEP 440: Record Patterns andRecord Patterns inJava Platform, Standard Edition Java Language Updates.
switch statement transfers control to one of several statements or expressions, depending on the value of its selector expression. Extending pattern matching toswitch allows an expression to be tested against a number of patterns, each with a specific action, so that complex data-oriented queries can be expressed concisely and safely. In this release:enum constants ascase constants inswitch expressions and statements are allowed.SeeJEP 441: Pattern Matching for switch andPattern Matching for switch Expressions and Statements inJava Platform, Standard Edition Java Language Updates.
Preview Language Features
SeeJEP 430: String Templates (Preview) andString Templates inJava Platform, Standard Edition Java Language Updates.
_).SeeJEP 443: Unnamed Patterns and Variables (Preview) andUnnamed Patterns and Variables inJava Platform, Standard Edition Java Language Updates.
SeeJEP 445: Unnamed Classes and Instance Main Methods (Preview) andUnnamed Classes and Instance Main Methods inJava Platform, Standard Edition Java Language Updates.
SeePreview Language and VM Features for more information about preview features.
Library Improvements
SeeJEP 444: Virtual Threads andVirtual Threads inJava Platform, Standard Edition Core Libraries.
SeeJEP 431: Sequenced Collections andCreating Sequenced Collections, Sets, and Maps inJava Platform, Standard Edition Core Libraries.
SeeJEP 452: Key Encapsulation Mechanism API andThe KEM Class inJava Platform, Standard Edition Security Developer's Guide.
Library Improvements Previews and Incubator
Arena interfaceclock_gettime)libffi, to facilitate portingVaList classSeeJEP 453: Structured Concurrency (Preview) andStructured Concurrency inJava Platform, Standard Edition Core Libraries.
SeeJEP 446: Scoped Values (Preview) and theScopedValue class in the Java API Specification.
SeeJEP 12: Preview Features andJEP 11: Incubator Modules for more information about preview features and incubating APIs.
Performance Improvements
Application performance has been improved by extending the Z Garbage Collector (ZGC) to maintain separategenerations for young and old objects. This will allow ZGC to collect young objects, which tend to die young, more frequently.
SeeJEP 439: Generational ZGC andThe Z Garbage Collector inJava Platform, Standard Edition HotSpot Virtual Machine Garbage Collection Tuning Guide.
Stewardship
Warnings are issued when agents are loaded dynamically into a running JVM. These warnings aim to prepare users for a future release which disallows the dynamic loading of agents by default in order to improve integrity by default.
SeeJEP 451: Prepare to Disallow the Dynamic Loading of Agents.
Removed APIs, Tools, and Components
For more details on removals and deprecations, seeFeatures and Options Removed and Deprecated in JDK 21.
In addition, there are security related updates that you need to be aware of. SeeSecurity Updates in JDK 21.
SeeJDK 20 Release Notes for additional descriptions of the new features and enhancements, and API specification in JDK 20.
The following are some of the updates in Java SE 20 and JDK 20:
Concurrency Model Previews and Incubators
Language Changes
switch Expressions and Statements has been further refined as follows:switch expression or a patternswitch statement) over anenum class throws aMatchException instead of an IncompatibleClassChangeError if noswitch label applies at run time.switch labels is simpler.switch statements and expressions,instanceof expressions, and enhancedfor statements.for statement.SeePreview Language and VM Features for more information about preview features.
Library Changes
MemorySegment andMemoryAddress abstractions are unified (memory addresses are now modeled by zero-length memory segments).MemoryLayout hierarchy is enhanced to facilitate usage with pattern matching in switch expressions and statements. SeePattern Matching for switch Expressions and Statements.MemorySession has been split into Arena andSegmentScope to facilitate sharing segments across maintenance boundariesRemoved APIs, Tools, and Components
For more details on removals and deprecations, seeFeatures and Options Deprecated in JDK 20.
In addition, there are security related updates that you need to be aware of. SeeSecurity Updates in JDK 20.
SeeJDK 19 Release Notes for additional descriptions of the new features and enhancements, and API specification in JDK 19.
The following are some of the updates in Java SE 19 and JDK 19:
Concurrency Model Update Previews
Language Changes
switch Expressions and Statements has been re-previewed in this release. This feature enables an expression to be tested against a number of patterns, each with a specific action, so that complex data-oriented queries can be expressed concisely and safely. SeeJEP 427: Pattern Matching for switch (Third Preview) andPattern Matching for switch Expressions and Statements inJava Platform, Standard Edition Java Language Updates.Library Changes
Removed APIs, Tools, and Components
For more details on removals and deprecations, seeFeatures and Options Deprecated in JDK 19.
In addition, there are security related updates that you need to be aware of. SeeSecurity Updates in JDK 19.
SeeJDK 18 Release Notes for additional descriptions of the new features and enhancements, and API specification in JDK 18.
The following are some of the updates in Java SE 18 and JDK 18:
Tools
jwebserver enables you to start a minimal web server that serves static files. This tool is useful for prototyping and testing. SeeJEP 408: Simple Web Server.@snippet tag is added to JavaDoc's Standard Doclet, which simplifies the inclusion of example source code in API documentation. SeeJEP 413: Code Snippets in Java API Documentation andProgrammer's Guide to Snippets.Library Changes
java.net.InetAddress can make use of resolvers other than the platform's built-in resolver. SeeJEP 418: Internet-Address Resolution SPI. See also the sectionSpecify Mappings from Host Names to IP Addresses inJava Platform, Standard Edition Core Libraries for information about thejdk.net.hosts.file system property, which enables you to configureInetAddress to use a specifichosts file, rather than the system-wide resolver, to map host names to IP addresses.java.lang.reflect andjava.lang.invoke APIs. SeeJEP 416: Reimplement Core Reflection with Method Handles.Preview Features and Incubator Modules
SeeJEP 12: Preview Features for more information about preview features andJEP 11: Incubator Modules for more information about incubator modules.
switch Expressions and Statements has been re-previewed in this release. This feature allows an expression to be tested against a number of patterns, each with a specific action, so that complex data-oriented queries can be expressed concisely and safely. SeeJEP 420: Pattern Matching for switch (Second Preview) andPattern Matching for switch Expressions and Statements inJava Platform, Standard Edition Java Language Updates.Removed APIs, Tools, and Components
For more details on removals and deprecations, see:
In addition, there are security related updates that you need to be aware of. SeeSecurity Updates in JDK 18.
SeeJDK 17 Release Notes for additional descriptions of the new features and enhancements, and API specification in JDK 17.
The following are some of the updates in Java SE 17 and JDK 17:
New Language Feature
Library Changes
Other Changes
sun.misc.Unsafe. However, it will no longer be possible to relax the strong encapsulation of internal elements using a single command-line option, as it was possible in JDK 9 through JDK 16. SeeJEP 403: Strongly Encapsulate JDK Internals by Default.strictfp) and subtly different default floating-point semantics. SeeJEP 306: Restore Always-Strict Floating-Point Semantics.Deprecations
Preview Features and Incubator Modules
SeeJEP 12: Preview Features for more information about preview features andJEP 11: Incubator Modules for more information about incubator modules.
switch expressions and statements is introduced in this release. This feature allows an expression to be tested against a number of patterns, each with a specific action, so that complex data-oriented queries can be expressed concisely and safely. SeeJEP 406: Pattern Matching for switch (Preview) andPattern Matching for Switch Expressions and Statements inJava Platform, Standard Edition Java Language Updates guide.Removed APIs, Tools, and Components
See:
In addition, there are security related updates that you need to be aware of. See:Security Updates in JDK 17.
SeeJDK 16 Release Notes for additional descriptions of the new features and enhancements, and API specification in JDK 16.
The following are some of the updates in Java SE 16 and JDK 16:
instanceof operator. This feature allows common logic in a program, namely the conditional extraction of components from objects, to be expressed more concisely and safely. SeeJEP 394: Pattern Matching for instanceof andPattern Matching for instanceof inJava Platform, Standard Edition Java Language Updates guide.sun.misc.Unsafe. You can choose the relaxed strong encapsulation that has been the default since JDK 9. SeeJEP 396: Strongly Encapsulate JDK Internals by Default andStrong Encapsulation in the JDK.jpackage tool, which was incubated in JDK 14, is now a permanent feature. The tool packages a Java application into a platform-specific package that includes the necessary dependencies. SeeJEP 392: Packaging Tool andJava Platform, Standard Edition Packaging Tool User's Guide.Preview Features and Incubator Modules
SeeJava Language Preview Feature for more information about preview features.
sealed,non-sealed, andpermits as contextual keywords. SeeJEP 397: Sealed Classes (Second Preview) andSealed Classes inJava Platform, Standard Edition Java Language Updates guide.jdk.incubator.vector, is provided to express vector computations. It reliably compiles at runtime to optimal vector hardware instructions on supported CPU architectures and thus achieve superior performance to equivalent scalar computations. SeeJEP 338: Vector API (Incubator).Removed APIs, Tools, and Components
See:
In addition, there are security related updates that you need to be aware of. See:Security Updates in JDK 16.
SeeJDK 15 Release Notes for the complete list of new features and enhancements in JDK 15.
The following are some of the updates in Java SE 15 and JDK 15:
Text blocks are multiline string literals that avoid the need for most escape sequences, automatically format the string in a predictable way, and give the developer control over the format when desired. SeeJEP 378: Text Blocks andProgrammer's Guide to Text Blocks.
-XX:+UseZGC. SeeJEP 377: ZGC: A Scalable Low-Latency Garbage Collector (Production).Preview and Incubator Features
SeeJava Language Preview Feature for more information about preview features.
instanceof, a preview feature from Java SE 14, is re-previewed for this release. This feature allows common logic in a program, namely the conditional extraction of components from objects, to be expressed more concisely and safely. SeeJEP 375: Pattern Matching for instanceof (Second Preview) andPattern Matching for the instanceof inJava Platform, Standard Edition Java Language Updates guide.Removed APIs, Tools, and Components
See:
In addition, there are security related updates that you need to be aware of. See:Security Updates in JDK 15.
The following are some of the changes in Java SE 14 and JDK 14:
case ... : labels (with fall through) or newcase ... -> labels (with no fall through), with a further new statement for yielding a value from a switch expression. SeeJEP 361: Switch Expressions (Standard) andJava Language Changes.FileChannel API can be used to createMappedByteBuffer instances that refer to non-volatile (NVM) memory. SeeJEP 352: Non-Volatile Mapped Byte Buffers.com.sun.management.OperatingSystemMXBean to ensure that it reports values based on the current operating environment, such as a container environment. The MXBean for tools to get information on the operating system has been improved for container environments. SeeOperatingSystemMXBean made container aware.Experimental, Preview, and Incubator Features
Records is aJava language preview feature, which provides a compact syntax for declaring classes that are transparent holders for shallowly immutable data. SeeJEP 359: Records (Preview).instanceof is aJava language preview feature that simplifies theinstanceof-and-cast idiom. SeeJEP 305: Pattern Matching for instanceof (Preview).jpackage, a simple tool for packaging self-contained Java applications. SeeJEP 343: Packaging Tool (Incubator).Removed APIs, Tools, and Components
See:
In addition, there are security related updates that you need to be aware of. See:Security Updates in JDK 14.
The following were some of the important enhancements in Java SE 13 and JDK 13:
switch expression, a preview language feature, was extended to be used as either a statement or an expression, so that both forms can use either traditional labels (with fall through) or new labels (with no fall through). It is used with a further new statement for yielding a value from aswitch expression. SeeJEP 354: Switch Expressions (Preview) andJEP 12: Preview Language and VM Features.java.net.Socket andjava.net.ServerSocket APIs was replaced with a simpler and more modern implementation that is easy to maintain and debug. SeeJEP 353: Reimplement the Legacy Socket API.The following were some of the important additions and updates in Java SE 12 and JDK 12:
switch statement was extended so that it can be used either as a statement or an expression. This is a preview language feature. SeeJEP 325: Switch Expressions (Preview) andJEP 12: Preview Language and VM Features.NumberFormat added support for formatting a number in its compact form. SeeCompact Number Formatting Support.JDK 11 had some significant changes too. As JDK 11 is a long term support (LTS) release, you should be familiar with the following important changes in JDK 11 release:
Oracle no longer offers JRE and Server JRE downloads; consequently, Auto-Update is not available anymore.
Java Web Start, Java Plugin, and Java Control Panel are not available in JDK. SeeRemoval of the Deployment Stack.
JavaFX is no longer included in the JDK. It is now available as a separate download fromhttps://openjfx.io/.
JAXB and JAX-WS are no longer bundled with JDK. SeeRemoval of Java EE and CORBA Modules.