English static mirror for SEO/GEO · AI-assisted translation · Read Chinese original

Java 25 LTS Overview: Key Features and Improvements

Forum topic · ✨步子哥 · 2025-10-13

Summary

Java 25, released on September 16, 2025, is the next Long-Term Support (LTS) release of the Java platform following Java 21. It includes 18 JDK Enhancement Proposals (JEPs) spanning language features, standard libraries, APIs, and runtime improvements. Highlights include Compact Object Headers (JEP 512) reducing object header size from 12 to 8 bytes, Key Derivation Functions (JEP 514) as building blocks for post-quantum cryptography, PEM Encodings of Cryptographic Objects (JEP 510), a third preview of Structured Concurrency (JEP 511), and a third preview of Primitive Types in Patterns, instanceof, and switch (JEP 513/515). Performance features include experimental JFR CPU-Time Profiling (JEP 509), JFR Cooperative Sampling (JEP 516), JFR Method Timing and Tracing (JEP 517), the standardization of the Shenandoah low-latency garbage collector (JEP 518), and Ahead-of-Time command-line ergonomics supporting Project Leyden. The release also drops 32-bit x86 support. This article summarizes the main JEPs, their benefits, and upgrade guidance with links to official release notes.

Java 25 Overview

Java 25 is the next Long-Term Support (LTS) release of the Java platform, officially released (General Availability) on September 16, 2025. It is a significant milestone that introduces enhancements across the language, standard libraries, APIs, and runtime — a total of 18 JEPs (JDK Enhancement Proposals), including 5 features targeting AI development, several preview and incubator features, plus performance optimizations and security improvements. These changes aim to boost developer productivity, application performance, and security, with particular support for post-quantum cryptography (PQC) and AI-related workloads.

Compared with the previous LTS, Java 21, Java 25 accumulates several releases of iteration, including further refinement of pattern matching, maturation of virtual threads, and runtime optimizations. Upgrading from earlier versions also brings intermediate features such as the Foreign Function & Memory API.

Key Features (JEPs)

| JEP | Feature | Type | Description | Benefits | |-----|---------|------|-------------|----------| | JEP 509 | JFR CPU-Time Profiling | Experimental | Uses kernel CPU timers on Linux to capture CPU-time profiling of Java programs via JFR (JDK Flight Recorder). | Helps developers diagnose performance bottlenecks more precisely on Linux; may extend to other platforms later. | | JEP 510 | PEM Encodings of Cryptographic Objects | Standard | Supports Privacy-Enhanced Mail (PEM) encoding of cryptographic objects, aligned with RFC 5705 and RFC 8446. | Enhances TLS/SSL security; works with new APIs such as javax.net.ssl.ExtendedSSLSession. | | JEP 511 | Structured Concurrency (Third Preview) | Preview | Third preview of structured concurrency, supporting try-with-resources-style management of concurrent tasks. | Simplifies multithreaded code, reduces concurrency bugs, improves readability and reliability. | | JEP 512 | Compact Object Headers | Standard | Compresses object headers, reducing size from 12 to 8 bytes. | Significantly lowers memory usage, especially in high object-density applications; positive impact on GC and performance. | | JEP 513 | Ahead-of-Time Command-Line Ergonomics | Standard | New JVM flag -XX:AOTCacheOutput; disabling dynamic features to evaluate AOT compilation compatibility. | Paves the way for future AOT compilation, helps identify reflection/class-loading issues, supports Project Leyden static images. | | JEP 514 | Key Derivation Functions | Standard | New API for key derivation functions (KDF), a building block for post-quantum cryptography (PQC). | Improves cryptographic security against quantum computing attacks; Oracle highlights this as key for AI and security. | | JEP 515 | Primitive Types in Patterns, instanceof, and switch (Third Preview) | Preview | Third preview of primitive types in pattern matching, instanceof, and switch. | Extends pattern matching for more concise code, enabling direct pattern handling for types like int. | | JEP 516 | JFR Cooperative Sampling | Standard | Cooperative sampling mode for JFR, reducing sampling overhead. | Improves runtime diagnostics performance, suitable for production monitoring. | | JEP 517 | JFR Method Timing and Tracing | Standard | JFR support for method timing and tracing, enhancing method-level profiling. | Provides finer-grained performance insight to help optimize hot code. | | JEP 518 | Shenandoah Garbage Collector | Standard | Standardizes the Shenandoah GC with low-latency collection. | Suited to real-time and high-throughput applications, reducing GC pause times. |

Other Notable Changes

  • Performance optimizations: String::hashCode benefits from constant folding, notably improving performance for string keys in static immutable maps. Overall runtime is faster, with better memory management and GC efficiency.
  • Removed support: The 32-bit x86 port is no longer maintained, focusing development on 64-bit architectures. Older 32-bit systems must upgrade to 64-bit.
  • AI and security focus: Oracle highlights 5 AI-related features (such as JFR enhancements and PQC support) to help build efficient AI applications.
  • Tooling support: IDEs such as IntelliJ IDEA have quickly integrated the new features, including inspections, quick fixes, and debugging support.

Upgrade Recommendations

Java 25 is the first LTS after Java 21, and early migration is recommended, especially for projects needing performance and modern language features. Downloads are available from Oracle JDK or OpenJDK (jdk.java.net). Full changelog: Oracle JDK 25 Release Notes. If upgrading from Java 21, pay particular attention to the pattern matching and concurrency preview features, which can greatly simplify your code.

Tags

#java#java-25#lts#jep#performance#post-quantum-cryptography#structured-concurrency#jfr

This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/176030901