21.0.10

Latest release in branch Java SE 21
Released 2 months ago (January 20, 2026)

Software Java/Java SE
Branch Java SE 21
Status LTS
Supported
End of premier support September 2028
End of extended support September 2031
First official release version 21
First official release date 2 years ago (September 19, 2023)
Release notes https://www.oracle.com/java/technologies/javase/21-0-10-relnotes.html
Documentation https://docs.oracle.com/javase/21
Download https://www.oracle.com/java/technologies/javase/jdk21-archive-downloads.html
Java/Java SE Java SE 21 Releases View full list

What is New in Java 21

Java 21 is a Long-Term Support (LTS) release that delivers major improvements in developer productivity and application performance. It finalizes several powerful features like pattern matching, record patterns, and virtual threads, while introducing new language constructs such as sequenced collections and string templates (preview). These changes make code simpler, safer, and more scalable.

Virtual Threads (Standard)

Virtual threads, previously known as Project Loom, are now a permanent part of the JDK. They allow millions of lightweight threads to run on a small number of platform threads, greatly simplifying high-concurrency applications without needing complex async frameworks.

Thread thread = Thread.ofVirtual().name("worker").start(() -> {
    // Your task here
});
thread.join();

Structured concurrency (preview) helps manage groups of related virtual threads as a unit, making error handling and cancellation much easier.

Pattern Matching Enhancements

Record Patterns (Standard)

You can now deconstruct record values directly in pattern matching, making code much cleaner when working with data objects.

if (obj instanceof Point(int x, int y)) {
    System.out.println(x + y);
}
Pattern Matching for switch (Standard)

Switch expressions and statements now support type patterns, guarded patterns, and null handling, reducing boilerplate and improving readability.

String result = switch (obj) {
    case String s when s.length() > 5 -> "Long string";
    case String s -> "Short string";
    case Integer i -> "Number: " + i;
    default -> "Other";
};

New Language Features (Preview)

String Templates (Preview)

A safer and more flexible way to embed expressions in strings, with processor-based validation and transformation.

String name = "Alice";
String greeting = STR."Hello \{name}! Today is \{new Date()}.";
Unnamed Patterns and Variables (Preview)

Use underscore (_) to indicate values that are intentionally unused, reducing warnings and clarifying intent.

if (obj instanceof Point(_, int y)) {
    // Only care about y
}

Sequenced Collections (Standard)

A new hierarchy of interfaces adds consistent methods to access the first and last elements of ordered collections like List, Deque, and SortedSet.

SequencedCollection<String> coll = new ArrayList<>();
coll.addFirst("first");
coll.addLast("last");
String first = coll.getFirst();

This eliminates the need to cast or use different APIs depending on the collection type.

Key API and Library Updates

  • New java.util.concurrent APIs for structured concurrency (preview)
  • Improved Foreign Function & Memory API (third preview) for safer native code access
  • Vector API (sixth incubator) for high-performance vector computations
  • Enhanced deprecation annotations with @Deprecated(forRemoval = true) now standard
  • Generational mode enabled by default in ZGC for better performance

Removed and Deprecated Features

Feature Status
Legacy SecurityManager Deprecated for removal (planned for future release)
Old finalize() method Further deemphasized
32-bit x86 ports Removed
Experimental AOT and JIT compiler (Jaotc) Removed

Performance and Tooling Improvements

Garbage collectors like ZGC and Shenandoah now enable generational mode by default, reducing latency and memory overhead. The JDK includes better support for containers, improved diagnostics, and enhanced tooling for virtual threads.

Why Upgrade to Java 21

As an LTS release, Java 21 receives long-term support and security updates. It combines mature, production-ready features like virtual threads and pattern matching with forward-looking previews. Developers can write more concise, readable, and scalable code while benefiting from significant performance gains in concurrent applications.

Releases In Branch Java SE 21

Version Release date
21.0.10 2 months ago
(January 20, 2026)
21.0.9 5 months ago
(October 21, 2025)
21.0.8 9 months ago
(July 15, 2025)
21.0.7 1 year ago
(April 15, 2025)
21.0.6 1 year ago
(January 21, 2025)
21.0.5 1 year ago
(October 15, 2024)
21.0.4 1 year ago
(July 16, 2024)
21.0.3 2 years ago
(April 16, 2024)
21.0.2 2 years ago
(January 16, 2024)
21.0.1 2 years ago
(October 17, 2023)
21 2 years ago
(September 19, 2023)