Java 21 is Coming – Know the Latest Features in JDK 21
Tags: java, programming, javascript, json
Published: 2023-09-19 09:54:41

It's that time of the year again - Java is getting a major upgrade with the release of version 21. While Java has seen incremental updates on an annual cadence for the past few years, version 21 marks one of the biggest changes to the language in recent times.
 
Java 21 is the next major long-term support release that brings modest new features and lays the foundation for the future of Java development. It will be supported for many years, making it a stable choice for production systems.

## Java 21 Launch Event
Join us in celebrating the imminent release of Java 21! You're invited to our special event on the Java YouTube Channel on September 19th from 13:00 to 21:00 UTC. During this 8-hour live stream, we'll dive into the exciting launch of Java 21 and share some exciting announcements along the way. Don't miss out! - https://dev.java/community/java-21-launch/

All times are UTC (PDT is UTC-7, EDT is UTC-4, CEST is UTC+2, IST is UTC+5.5, JST is UTC+9):

- 13:00: Java 21 review and a big reveal 🛝
- 14:00: Virtual threads with Ron Pressler, Tomas Langer, and more 🧵
- 15:30: CloudWorld Java panel ☁️
- 16:30: Pattern matching with Brian Goetz 🤓
- 17:30: Performance improvements with Geoffrey de Smet ⏱
- 18:00: JDK release process with Mark Reinhold 👷‍♂️
- 18:30: Live in Paris and Karlsruhe 🥖🍺
- 19:30: API improvements with Stuart Marks 👨‍⚕️
- 21:00: Goodnight! 🛌


## New Features of Java 21

- Pattern Matching for Switch Expressions: Enhances switch with pattern matching capabilities similar to functional languages. Allows matching on type patterns, guards, etc.
- Unicode 14 Text Blocks: Support for new Unicode 14.0 characters and emojis within text blocks.
- Vector API Enhancements: New Vector methods like toArray(), updateddocs and performance improvements.
- Deprecate Methods in Key Classes: Methods like DatagramSocketImpl.getTTL() and Thread.destroy() are deprecated.
- Sealed Classes (Second Preview): Extends support for sealed classes and interfaces.
- Migrate to JDK Enhancement Proposal Process: JEP 400 introduces a new JDK Enhancement Proposal process.
- Remove RMI Activation: Deprecates and removes RMI activation from the JDK.
- macOS/AArch64 Port: Production-ready support for macOS on ARM chips like M1.
- Migrate to GitHub: Adopts GitHub as the official source code repository after Mercurial.
- Foreign Linker API: Native linking introduces jdk.foreign linker API.

## Support in Java 21

- As a long-term support (LTS) release, Java 21 will receive several years of support from Oracle.
- The public LTS support will last till at least September 2027.
- Commercial support from Oracle is likely to be available until 2032.
- Java 21 will receive critical security updates and bug fixes during support.
- Non-LTS releases like Java 19 will only be supported for 6 months. So, Java 21 is recommended for production systems.
- Many Java tools, frameworks, and libraries will continue to work on Java 21 without issues. Some may require minor updates.
- New features may get backported to older LTS versions like Java 17, though priority will be on Java 21 patches.
- While Java 8 is still supported, upgrading to Java 21 is recommended for critical systems and access to the latest features.
- For systems that cannot upgrade to Java 21 yet, Java 17 or Java 11 provide interim upgrade options.

**Java 21** takes the language to new heights with enhancements across the board, from modules to patterns, strings to functional programming. Expect a much improved and even more developer-friendly Java when version 21 releases this September 2023!