Latest in branch Java SE 21
21.0.11
Released 21 Apr 2026
(1 month ago)
SoftwareJava/Java SE
VersionJava SE 21
StatusLTS
Supported
Class file version65.0
Initial release21
19 Sep 2023
(2 years ago)
Latest release21.0.11
21 Apr 2026
(1 month ago)
End of
premier support
Sep 2028
(Ends in 2 years, 3 months)
End of
extended support
Sep 2031
(Ends in 5 years, 3 months)
Release noteshttps://www.oracle.com/java/technologies/javase/21-0-11-relnotes.html
Documentationhttps://docs.oracle.com/javase/21
Downloadhttps://www.oracle.com/java/technologies/javase/jdk21-archive-downloads.html
Java/Java SE Java SE 21 ReleasesView 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

VersionRelease date
21.0.1121 Apr 2026
(1 month ago)
21.0.1020 Jan 2026
(4 months ago)
21.0.921 Oct 2025
(7 months ago)
21.0.815 Jul 2025
(10 months ago)
21.0.715 Apr 2025
(1 year ago)
21.0.621 Jan 2025
(1 year ago)
21.0.515 Oct 2024
(1 year ago)
21.0.416 Jul 2024
(1 year ago)
21.0.316 Apr 2024
(2 years ago)
21.0.216 Jan 2024
(2 years ago)
21.0.117 Oct 2023
(2 years ago)
2119 Sep 2023
(2 years ago)