Overview of New Features in Java 17
Introduction
Java 17 was released on 14th September 2021. It is a long-term support (LTS) release - the first since Java 11Click to read: Java 11 - and the version most teams moved to from Java 11. Its own fourteen JDK Enhancement Proposals (JEPs) finalized sealed classes, reworked random number generation, and completed the strong encapsulation of the JDK's internals. But for anyone upgrading from Java 11, the real story is everything which arrived across Java 12 to 17. This article gives an overview of the new features in Java 17, and then summarizes all the major changes since Java 11, with links to detailed tutorials.
Language and library features in Java 17
Removals and deprecations in Java 17
Upgrading from Java 11 to 17
- Sealed Classes - JEP 409 - a class or interface can list exactly which classes may extend or implement it. Read the sealed classes tutorialClick to read tutorial: Java 17 Sealed Classes Tutorial with Examples.
- Enhanced Pseudo-Random Number Generators - JEP 356 - a common
RandomGeneratorinterface and modern algorithms. Read about the RandomGenerator APIClick to read tutorial: Java 17 Random Number Generators: RandomGenerator API. - Context-Specific Deserialization Filters - JEP 415 - a JVM-wide filter factory chooses a deserialization filter for every stream. Explained, with
HexFormatandInstantSource, in the Java 17 API additionsClick to read tutorial: Java 17 API Additions: HexFormat, InstantSource and More. - Restore Always-Strict Floating-Point Semantics - JEP 306 - all floating-point operations are strict again, so
strictfpis no longer needed and results are the same on every platform. - Pattern Matching for switch (Preview) - JEP 406 - patterns in
switchcases, finalized in Java 21. Read about pattern matching for switchClick to read: pattern matching for switch.
- Strongly Encapsulate JDK Internals - JEP 403 - the
--illegal-accessoption was removed; only--add-openscan open internal packages. Read about the strong encapsulation of JDK internalsClick to read tutorial: Strong Encapsulation of JDK Internals in Java 16 and 17. - macOS/AArch64 Port - JEP 391 and New macOS Rendering Pipeline - JEP 382 - native support for Apple Silicon Macs, and Swing and Java 2D rendering using Apple's Metal API instead of the deprecated OpenGL.
- Foreign Function & Memory API (Incubator) - JEP 412 and Vector API (Second Incubator) - JEP 414 - continued work on APIs which were finalized (FFM in Java 22Click to read: FFM in Java 22) or are still incubating (Vector).
- Deprecate the Security Manager for Removal - JEP 411 - the Security Manager, rarely used for its original purpose of sandboxing untrusted code, was deprecated. It was permanently disabled in Java 24.
- Deprecate the Applet API for Removal - JEP 398 - no browser had supported applets for years; the API was removed in Java 26.
- Remove RMI Activation - JEP 407 and Remove the Experimental AOT and JIT Compiler - JEP 410 - the rarely used RMI Activation mechanism, and the experimental Graal-based
jaotcahead-of-time compiler and JIT option, were removed.
Each release also has its own overview: Java 12Click to read tutorial: Overview of New Features in Java 12, Java 13Click to read tutorial: Overview of New Features in Java 13, Java 14Click to read tutorial: Overview of New Features in Java 14, Java 15Click to read tutorial: Overview of New Features in Java 15 and Java 16Click to read tutorial: Overview of New Features in Java 16.
- Libraries and frameworks: the most common upgrade problem is strong encapsulation breaking old versions of libraries which used JDK internals. Upgrade dependencies first - for example, Spring Boot 3 requires Java 17.
- Removed features: check for Nashorn (use GraalJS or the standalone Nashorn library), CMS GC flags (switch to G1 or ZGC), and Pack200.
- Build tools: update Maven and Gradle and their plugins to versions which support Java 17 bytecode.
- Take advantage gradually: new language features can be adopted one class at a time - records for DTOs and value objects, text blocks for embedded SQL and JSON, and switch expressions and pattern matching to simplify conditional logic.
Continue Reading Java 12 to 17 Tutorials
Java 17 Sealed Classes Tutorial with ExamplesClick to read tutorial: Java 17 Sealed Classes Tutorial with Examples Java 17 Random Number Generators: RandomGenerator APIClick to read tutorial: Java 17 Random Number Generators: RandomGenerator API Java 17 API Additions: HexFormat, InstantSource and MoreClick to read tutorial: Java 17 API Additions: HexFormat, InstantSource and More Strong Encapsulation of JDK Internals in Java 16 and 17Click to read tutorial: Strong Encapsulation of JDK Internals in Java 16 and 17 Overview of New Features in Java 12Click to read tutorial: Overview of New Features in Java 12 Overview of New Features in Java 13Click to read tutorial: Overview of New Features in Java 13 Overview of New Features in Java 14Click to read tutorial: Overview of New Features in Java 14 Overview of New Features in Java 15Click to read tutorial: Overview of New Features in Java 15 Overview of New Features in Java 16Click to read tutorial: Overview of New Features in Java 16
Java 17 Sealed Classes Tutorial with ExamplesClick to read tutorial: Java 17 Sealed Classes Tutorial with Examples Java 17 Random Number Generators: RandomGenerator APIClick to read tutorial: Java 17 Random Number Generators: RandomGenerator API Java 17 API Additions: HexFormat, InstantSource and MoreClick to read tutorial: Java 17 API Additions: HexFormat, InstantSource and More Strong Encapsulation of JDK Internals in Java 16 and 17Click to read tutorial: Strong Encapsulation of JDK Internals in Java 16 and 17 Overview of New Features in Java 12Click to read tutorial: Overview of New Features in Java 12 Overview of New Features in Java 13Click to read tutorial: Overview of New Features in Java 13 Overview of New Features in Java 14Click to read tutorial: Overview of New Features in Java 14 Overview of New Features in Java 15Click to read tutorial: Overview of New Features in Java 15 Overview of New Features in Java 16Click to read tutorial: Overview of New Features in Java 16