JDK 25 · JSR 400 · Long-term support

Java 25

JDK 25 is the reference implementation of Java SE 25, JSR 400. It reached general availability on 16 September 2025. Most vendors treat it as a long-term support release. The 18 JEPs below are the JDK 25 feature set from the OpenJDK project page. Titles and status come from those JEP pages. Java 21 stays in this curriculum.

How to read the status

Language

Compact Source Files and Instance Main Methods

JEP 512 · Final · Language

Beginners can write a small program without the declarations used for large programs. The same language and tools still compile and run it.

Preview from JDK 21 (JEP 445) through JDK 24. Finalized in JDK 25. Earlier previews called the files simple source files.

OpenJDK JEP 512 (leaves JavaMastery)

Module Import Declarations

JEP 511 · Final · Language

import module M imports the public types from the packages that module exports. The importing file does not itself have to be in a module.

Preview in JDK 23 (JEP 476) and JDK 24 (JEP 494). Finalized in JDK 25 without change.

OpenJDK JEP 511 (leaves JavaMastery)

Curriculum file: versions11Java25ModuleImport.java

Primitive Types in Patterns, instanceof, and switch (Third Preview)

JEP 507 · Preview · Language

Pattern matching, instanceof, and switch can use primitive types. This is a preview language feature.

First preview in JDK 23 (JEP 455). Re-previewed without change in JDK 24 (JEP 488). JDK 25 is the third preview, again without change.

OpenJDK JEP 507 (leaves JavaMastery)

APIs / Libraries

Scoped Values

JEP 506 · Final · APIs / Libraries

A method can share immutable data with its callees and with child threads. Scoped values are easier to reason about than thread-local variables, and they cost less with virtual threads.

Incubated in JDK 20 (JEP 429). Previewed in JDK 21 through JDK 24. Finalized in JDK 25. ScopedValue.orElse no longer accepts null.

OpenJDK JEP 506 (leaves JavaMastery)

Related reading: Java versions reference

Curriculum file: versions9Java25ScopedValues.java

Key Derivation Function API

JEP 510 · Final · APIs / Libraries

javax.crypto.KDF derives keys from a secret and other data. JDK 25 includes HKDF.

Preview in JDK 24 (JEP 478). Finalized in JDK 25 without change.

OpenJDK JEP 510 (leaves JavaMastery)

PEM Encodings of Cryptographic Objects (Preview)

JEP 470 · Preview · APIs / Libraries

A preview API encodes and decodes cryptographic keys, certificates, and certificate revocation lists in the PEM format.

Preview in JDK 25. The JEP says the API is disabled unless preview features are enabled.

OpenJDK JEP 470 (leaves JavaMastery)

Stable Values (Preview)

JEP 502 · Preview · APIs / Libraries

A stable value holds immutable data and can be initialized later than a final field, while still allowing constant-folding. This is a preview API.

Preview in JDK 25.

OpenJDK JEP 502 (leaves JavaMastery)

Structured Concurrency (Fifth Preview)

JEP 505 · Preview · APIs / Libraries

A preview API treats related tasks in different threads as one unit of work, so cancellation and errors stay with that unit.

Incubated in JDK 19 and JDK 20. Preview since JDK 21. JDK 25 is the fifth preview: a StructuredTaskScope opens through static factory methods, not public constructors. The curriculum file still needs --enable-preview and its comment shows the older constructor shape.

OpenJDK JEP 505 (leaves JavaMastery)

Related reading: Java Memory Model

Curriculum file: advconcurrency7StructuredConcurrency.java

Vector API (Tenth Incubator)

JEP 508 · Incubator · APIs / Libraries

An incubator API expresses vector computations that the runtime can compile to vector instructions on supported CPUs.

Incubating since JDK 16 (JEP 338). JDK 25 is the tenth incubation. The JEP says it stays in incubation until the Project Valhalla features it needs are available as previews.

OpenJDK JEP 508 (leaves JavaMastery)

JVM / Runtime

Remove the 32-bit x86 Port

JEP 503 · Final · JVM / Runtime

JDK 25 removes source and build support for the 32-bit x86 port. Other 32-bit architectures are unchanged.

Deprecated for removal in JDK 24 (JEP 501). Removed in JDK 25.

OpenJDK JEP 503 (leaves JavaMastery)

Ahead-of-Time Command-Line Ergonomics

JEP 514 · Final · JVM / Runtime

A common ahead-of-time cache can be created with one java launch, using -XX:AOTCacheOutput, instead of a separate record step and create step.

Simplifies the two-step AOT cache workflow added in JDK 24 (JEP 483). It does not add a new optimization.

OpenJDK JEP 514 (leaves JavaMastery)

Ahead-of-Time Method Profiling

JEP 515 · Final · JVM / Runtime

Method-execution profiles from a training run can be stored in the AOT cache, so the JIT can compile hot methods sooner when the application starts.

Extends the AOT cache from JEP 483. Production runs can still collect new profiles.

OpenJDK JEP 515 (leaves JavaMastery)

JFR Cooperative Sampling

JEP 518 · Final · JVM / Runtime

JDK Flight Recorder records a stack sample request immediately, then walks the Java stack at the next safepoint, instead of parsing stacks with unsafe heuristics.

Delivered in JDK 25. JEP 509 builds on this mechanism.

OpenJDK JEP 518 (leaves JavaMastery)

JFR CPU-Time Profiling (Experimental)

JEP 509 · Experimental · JVM / Runtime

On Linux, JDK Flight Recorder can sample threads by CPU time rather than wall-clock time. The JEP says this is an experimental feature.

Delivered in JDK 25. The jdk.CPUTimeSample event is off by default and tagged @Experimental. It does not need -XX:+UnlockExperimentalVMOptions. It is not a permanent API.

OpenJDK JEP 509 (leaves JavaMastery)

JFR Method Timing & Tracing

JEP 520 · Final · JVM / Runtime

JDK Flight Recorder can time and trace selected methods by instrumenting bytecode. The application source does not have to change.

Delivered in JDK 25.

OpenJDK JEP 520 (leaves JavaMastery)

Compact Object Headers

JEP 519 · Final · JVM / Runtime

Compact object headers change from an experimental option to a product feature. They are not the default layout.

Experimental in JDK 24 (JEP 450). In JDK 25, -XX:+UseCompactObjectHeaders no longer requires -XX:+UnlockExperimentalVMOptions.

OpenJDK JEP 519 (leaves JavaMastery)

Generational Shenandoah

JEP 521 · Final · JVM / Runtime

Shenandoah’s generational mode becomes a product feature. The default Shenandoah mode is still a single generation.

Experimental in JDK 24 (JEP 404). In JDK 25 the generational mode no longer requires -XX:+UnlockExperimentalVMOptions.

OpenJDK JEP 521 (leaves JavaMastery)

Related reading: JVM internals

Examples

  • versions9Java25ScopedValues.javaJava 25 example · Requires Java 25ScopedValue.where(...).run(...). Final in Java 25. Incubated in Java 20 and previewed in Java 21 through Java 24. This file is not a Java 20 program.
  • versions10Java25FlexibleConstructors.javaJava 25 example · Requires Java 25A constructor checks a value before super(...). Final in Java 25. Preview in Java 22, Java 23, and Java 24.
  • versions11Java25ModuleImport.javaJava 25 example · Requires Java 25import module java.base, then List.of without a package import. Final in Java 25. Preview in Java 23 and Java 24.
  • advconcurrency7StructuredConcurrency.javaStable demo; Java 25 preview API is only in the comment · Requires Java 8The main method uses CompletableFuture and runs without --enable-preview. The comment shows the Java 25 preview API: StructuredTaskScope.open with a Joiner. JEP 505 is still a preview.

Related reading

Historical notes

Since Java 21, scoped values, stream gatherers, the class-file API, the foreign function and memory API, flexible constructor bodies, module imports, and compact source files have become final, some of them in Java 22 or Java 24 rather than in Java 25. Structured concurrency is still a preview. The Vector API is still an incubator. JEP 509 is experimental. It is not final merely because it shipped in JDK 25.

Sources. Feature list and status: OpenJDK JDK 25 and the individual JEP pages. JSR 400 and the release month: Oracle Java SE specifications. OpenJDK JDK 25 (leaves JavaMastery)

All versions