Oracle announced the Java 20 a day ago this Tuesday. It’s a new short term release with 6 months support.
Java 20 (Oracle JDK 20) delivers thousands of performance, stability, and security improvements, including platform enhancements that will help developers improve productivity and drive innovation and growth across their organizations.
The new release delivers 7 JDK Enhancement Proposals to increase developer productivity, improve the Java language, and enhance the platform’s performance, stability, and security.
Record Patterns (Second Preview)
It allows users to nest record patterns and type patterns to create a powerful, declarative, and composable form of data navigation and processing. This helps increase developer productivity by enabling them to extend pattern matching to allow for more sophisticated and composable data queries.
Pattern Matching for Switch (Fourth Preview)
By extending pattern matching to switch, an expression can be tested against a number of patterns—each with a specific action—so that complex data-oriented queries can be expressed concisely and safely.
Scoped Values (Incubator)
Enables the sharing of immutable data within and across threads, which are preferred to thread-local variables – especially when using large numbers of virtual threads. This increases ease-of-use, comprehensibility, robustness, and performance.
Virtual Threads (Second Preview)
Significantly streamline the process of writing, maintaining, and observing high-throughput, concurrent applications by introducing lightweight virtual threads to the Java Platform. By enabling developers to easily troubleshoot, debug, and profile concurrent applications with existing JDK tools and techniques, virtual threads helps accelerate application development.
Structured Concurrency (Second Incubator)
Simplifies multithreaded programming by treating multiple tasks running in different threads as a single unit of work. This helps development teams streamline error handling and cancellation, improve reliability, and enhance observability.
Foreign Function & Memory API (Second Preview)
Enables Java programs to interoperate with code and data outside of the Java runtime. By efficiently invoking foreign functions (i.e., code outside the Java Virtual Machine [JVM]), and by safely accessing foreign memory (i.e., memory not managed by the JVM), this feature enables Java programs to call native libraries and process native data without requiring the Java Native Interface. This increases ease-of-use, performance, and safety.
Vector API (Fifth Incubator)
Introduce an API to express vector computations that reliably compile at runtime to optimal vector instructions on supported CPU architectures, thus achieving performance superior to equivalent scalar computations.
Get Java JDK 20
For OpenJDK JDK 20, it’s available in java.net via the link below:
For Oracle Java SE 20, the pre-build binary packages for Linux, macOS and Windows, are available to download at the link below:
NOTE: the java package for Linux does not have Java HOME and PATH configured, this step-by-step guide will show you how.