What's new in Java 25
A breakdown of the most significant changes in Java 25, including preview features, API updates, and what they mean for developers.
Java is verbose. Java is slow. Java is corporate garbage. Java is dead.
As you throw all this trash on java do you know that your Bank runs on java,Netflix runs on java, even Minecraft runs on java
And now, with Java 25 dropping as the first LTS release since Java 21, it's clear that Java isn't just surviving. It's thriving.

Introduction
Java 25 isn't just another release. JDK 25 launched on September 16, 2025, bringing 18 major enhancements that fundamentally change how you write Java. While many vendors will provide long-term support for their JDK 25 distributions, the platform itself focuses on making Java simpler, faster, and more accessible.
Java is now simpler, more accessible, and more powerful than ever before.If you've been hiding in your Java 8, 11, 17, or 21 bunker, now's the time to come out. This release cuts boilerplate, improves performance, and finally fixes features that made your code look like tax forms.
What you'll learn:
- How beginners can write Java without ancient rituals
- Performance improvements that reduce cloud costs by 10-20%
- Security features for quantum-safe encryption
- Which new features are production-ready versus preview
Prerequisites
Basic familiarity with Java programming
The acceptance that java is moving to a better place

Try Kodaschool for free
Click below to sign up and get access to free web, android and iOs challenges.
Language Features: Java Gets Simple
Write Your First Program Without the Ceremony
Remember explaining public static void main(String[] args)
before printing "Hello World"? By the time you finished, beginners had defected to Python.
JDK 25 finalizes compact source files and instance main methods after four preview rounds. Here's a complete Java program:
void main() {
println("Hello, Java 25!");
}
No class declaration. No public static void ceremony. The println()
method comes from the new IO
class, which provides simpler terminal I/O backed by System.out
and System.in
.
What's included automatically:
- Collections
- Date and time APIs
- File I/O
- System interactions
- Everything from
java.base
This makes Java competitive with Python and JavaScript for beginners without sacrificing enterprise capabilities. It's also great for writing Java scripts.
Module Imports That Actually Make Sense
Instead of importing individual types, import entire modules:
// Before
import java.sql.Connection;
import java.sql.Date;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
// With JDK 25
import module java.sql;
Module imports are superior to star imports because they import a coherent API instead of a random slice of it. They're ideal for experiments, demos, scripts, and early learning. This feature is final in JDK 25 without changes.
Flexible Constructor Bodies

Constructors used to force you to call super()
or this()
as the very first thing. Need to validate parameters first? Too bad.
JDK 25 adds a "prologue" to constructor bodies that executes before calling another constructor. The prologue can do whatever it wants except reference the instance under construction (except for field assignments).
public class User {
private final String email;
public User(String rawEmail) {
// Validate and clean the email BEFORE calling super
String cleaned = rawEmail.trim().toLowerCase();
if (!cleaned.contains("@")) {
throw new IllegalArgumentException("Invalid email");
}
this.email = cleaned;
super();
}
}
This is particularly handy when writing records, which require constructor chaining. The feature is final in JDK 25.
Pattern Matching for Primitives (Third Preview)

Pattern matching now handles primitive types in switch
and instanceof
, currently in its third preview and unchanged from JDK 24.
// No more boxing dance
if (obj instanceof int i) {
println("It's an int: " + i);
}
// Handle nullable booleans
switch (nullableBool) {
case true -> println("True");
case false -> println("False");
case null -> println("Null");
}
This eliminates the boxing dance and feels less like Java 1.2 code. Still seeking feedback before finalization.
API Improvements: Security and Concurrency
Key Derivation Functions (Final)

The KDF API is the second step toward supporting hybrid public key encryption, enabling smooth transition to quantum-safe algorithms. This matters now, so data intercepted today can't be decrypted when quantum computing arrives.
KDFs use cryptographic inputs like initial key material, salt values, and pseudorandom functions to create new cryptographically strong key material:
// Create an ExtractExpand parameter specification
AlgorithmParameterSpec params = HKDFParameterSpec.ofExtract()
.addIKM(initialKeyMaterial)
.addSalt(salt)
.thenExpand(info, 32);
// Derive a 32-byte AES key
SecretKey key = hkdf.deriveKey("AES", params);
No more copying questionable crypto code from Stack Overflow. The KDF API is final in JDK 25 after the Key Encapsulation Mechanism (KEM) API in JDK 21.
PEM Encoding Support (Preview)

You know those text blocks that start with -----BEGIN PUBLIC KEY-----
? That's PEM (Privacy Enhanced Mail) format, originally standardized for exchanging cryptographic objects via email.
Starting in preview with JDK 25, Java can convert between PEM text and cryptographic objects in binary formats like PKCS #8, PKCS #1, and X.509. This includes private and public keys, certificates, and certificate revocation lists.
No more third-party libraries to parse certificates.
Scoped Values (Final)
Scoped values are finally final after four preview rounds. They're like ThreadLocal but without memory leaks or career-ending production bugs.
This API shares immutable references to data with callees within a thread and child threads. It's easier to use, more comprehensible, robust, and performant than thread locals—perfect for passing request IDs or auth tokens when spawning virtual threads.
The tradeoff: data only passes one way within a predetermined scope, which covers the most common use case.
Structured Concurrency (Fifth Preview)
The structured concurrency API rethinks how to organize concurrency. If a task splits into concurrent subtasks, the task should await their completion and process their errors or results in the same scope.
Benefits:
- Code clarity: Always follows the same procedure—set up subtasks, wait for completion or cancellation, decide whether to succeed or fail
- Error handling: Failing subtasks can cancel other ongoing subtasks (short circuiting)
- Cancellation propagation: If a task gets cancelled, so do all subtasks, potentially down a large task tree
- Parent-child relationships: Clear thread hierarchy between tasks and subtasks
- Observability: Thread dumps display the thread/task hierarchy clearly
The API is in its fifth preview with noticeable revamps over earlier versions. Try it and report your experience to the loom-dev mailing list.
Stable Values (First Preview)
The stable values API offers lazy, exactly-once initialization that enables aggressive JIT performance optimizations through close cooperation with the runtime.
The reference to the instance, once created, is truly final and can't be changed even through reflection—like record fields but unlike final fields in regular classes.
The API uses a functional approach where invoking StableValue.supplier()
returns a supplier of the desired instance. Similar methods exist for lazily populated collections.
Performance: Money-Saving Improvements
Compact Object Headers (Production Ready)

Every object on the heap has a header the JVM uses for typing, locking, and garbage collection. Compact object headers, introduced experimentally in JDK 24, reduce this overhead by one-third to one-half.
Impact: 10-20% reduction in overall memory consumption in typical cases
Shrinking object headers from 96-128 bits down to 64 bits on 64-bit architectures means less RAM and fewer dollars to AWS. This results from denser memory layout and reduced GC pressure.
After extensive testing and production validation, compact object headers are production-ready in JDK 25. Enable with:
-XX:+UseCompactObjectHeaders
Observe your application carefully to verify it helps—results aren't guaranteed but likely positive.
Generational Shenandoah (Production Ready)

Shenandoah gained experimental generational mode in JDK 24. After stability and performance improvements, it's production-ready in JDK 25.
Generational mode provides better young-old generation separation with fewer GC pauses. Your microservices stop hiccupping every time they allocate a string.
Enable with:
-XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational
You no longer need -XX:+UnlockExperimentalVMOptions
.
AOT Method Profiling

Project Leyden's second launch-time improvement focuses on warm-up time—the gap between first useful work and peak performance.
During warm-up, the JVM profiles methods to find which are worth optimizing and how. If profiling happens during a training run and profiles are stored in the AOT cache, they load from there instead of being collected in production. The JIT compiler generates native code immediately at startup.
This happens automatically during the AOT workflow in JDK 25 without code changes. If cached information doesn't match runtime reality, it gets overruled.
New workflow option: Combine observe and create steps. The training run produces the actual cache directly, ready for production. Most cases are covered, though complex configurations may still need all three manual steps.
JDK Flight Recorder Improvements
Method Timing and Tracing
Two new JFR events make it easier to identify performance bottlenecks and debug production issues:
jdk.MethodTiming
jdk.MethodTrace
These events record execution times and stack traces for specific methods selected via command line, configuration files, JCommand, or JMX. Unlike sample-based profilers, they record complete and exact statistics.
This can impose larger CPU overhead than JFR's usual 1% target, so use for a few methods at a time. For larger numbers, sampling approaches remain recommended.
Cooperative Sampling
When JFR samples stack traces to create execution time profiles, it must parse them at "safe points." This creates safe point bias—frequently executed code spans without safe points might not appear in profiles.
JDK 25 combines the best of both approaches: emit sample requests at regular intervals, then reliably reconstruct full stack traces at the next safe point.
CPU Time Profiling (Experimental, Linux only)
Based on kernel signals emitted at fixed CPU time intervals, JFR now creates CPU time profiles. These differ from real-time profiles by excluding time spent waiting for memory, file systems, network I/O, etc.
Neither profile type is strictly better:
- Real-time profiles help reduce latency
- CPU time profiles identify CPU-intense methods limiting throughput
This feature is experimental and Linux-only for now. Check JEP 509 for details and share feedback on the hotspot-jfr-dev mailing list.
Other Notable Changes
32-bit x86 Port Removed
Bad news for the few still using 32-bit x86 hardware: the JDK port was removed entirely in JDK 25.
Benefits:
- Virtual threads, FFM, and Vector API no longer need 32-bit fallbacks
- Eliminates major opportunity costs
- Simplifies JDK build and test infrastructure
Vector API (Tenth Incubator)
The Vector API continues incubating, now in its tenth round. It provides SIMD operations without dropping to JNI, useful for numeric processing, signal processing, or ML in Java.
Not flashy, but valuable for performance-critical mathematical operations.
Understanding Long-Term Support
Important distinction: Java 25 is not an LTS version. JDK 25 distributions from various vendors will receive long-term support.
This matters because:
Support means a commitment to fix bugs with staff to answer your problems. This costs money.
Different JDK distributions offer different support levels:
- Some JDKs come without any support (like Oracle's OpenJDK builds from jdk.java.net)
- Some are free to use but require a contract for support (like Oracle JDK from oracle.com/java)
- Some are fully commercial with support included
- Some provide support on their cloud infrastructure but not on-premise
The reality:
- The Java Community Process (JCP) develops technical specifications
- OpenJDK develops the reference implementation
- Vendors ship binaries and decide which versions to offer maintenance and support for
Vendors typically offer similar timeframes and versions (11, 17, 21, 25), but this happens at the vendor level—not through OpenJDK or JCP planning. Java's feature development is unencumbered by support concerns.
For you, this means: Which JDK you choose determines your support level—not which Java version is "LTS."
Getting Started with JDK 25
Download options:
- Oracle's OpenJDK builds: jdk.java.net/25
- Other vendor distributions following shortly
IDE support:
- IntelliJ IDEA provides full support for JDK 25 features
- Other major IDEs have announced support
Migration checklist:
- Review the official JDK 25 release notes
- Test preview features with
--enable-preview
- Enable production-ready performance features like compact object headers
- Plan your migration timeline based on your vendor's support offering
Conclusion
JDK 25 delivers meaningful improvements across three dimensions:
Simplicity: Compact source files and flexible constructors make Java accessible to beginners and pleasant for experienced developers.
Performance: Compact object headers and generational Shenandoah reduce memory usage and GC pauses, translating to real cost savings.
Security: KDF API and PEM support enable quantum-safe encryption transitions.
Whether you're teaching programming, building microservices, or maintaining enterprise applications, JDK 25 offers tangible improvements worth the upgrade.
Java keeps outliving everything that tries to replace it—and keeps getting better.
Next steps:
- Download JDK 25 and try new features in a test project
- Review your vendor's support timeline for JDK 25
- Watch the Inside Java Newscast for technical deep dives
- Join discussions on dev.java
Further Reading
- JDK 25 Release Notes
- Inside Java Newscast - JDK 25 Overview
- Why Java 25 is Not an LTS Version
- All JEPs targeted to JDK 25
Java is for millenials nope not Java 25 ..
Happy Coding ...