Java Version Comparator
Java 17
LTS- Released
- Sep 2021
- Class file version
- 61
- Spring Boot
- Supported by Spring Boot 3.x and 4.x. Virtual threads need Java 21.
Java 25
LTS- Released
- Sep 2025
- Class file version
- 69
- Spring Boot
- Supported by Spring Boot 3.x and 4.x; spring.threads.virtual.enabled=true turns on virtual threads.
34 changes from Java 17 to 25, 6 of them removals or breaking changes
Check the removed / breaking items before upgrading
jdeps --jdk-internals on your JARs to find uses of JDK internals.Java 18Mar 2022
- APIsJEP 400
UTF-8 by default
Files and streams default to UTF-8 on every OS, not the platform charset.
- ToolsJEP 408
Simple web server
jwebserver serves a directory over HTTP.
- ToolsJEP 413
Code snippets in Javadoc
{@snippet} for compilable examples.
- Removed / breakingJEP 421
Finalization deprecated for removal
Use Cleaner or try-with-resources instead of finalize().
- APIs
Java 21LTSSep 2023
- APIsJEP 444
Virtual threads
Executors.newVirtualThreadPerTaskExecutor(): millions of cheap threads for blocking I/O.
- LanguageJEP 441
Pattern matching for switch
switch (shape) { case Circle c -> …; case Square s -> …; }
- LanguageJEP 440
Record patterns
if (obj instanceof Point(int x, int y)) …
- APIsJEP 431
Sequenced collections
getFirst(), getLast(), reversed() on List, Deque, LinkedHashSet and LinkedHashMap.
- JVM & GCJEP 439
Generational ZGC
ZGC with generations for better throughput.
- APIsJEP 452
Key Encapsulation Mechanism API
- Removed / breakingJEP 451
Dynamic agent loading warns
Agents attached at runtime print a warning; load them with -javaagent instead.
- APIs
Java 22Mar 2024
- LanguageJEP 456
Unnamed variables and patterns
catch (Exception _) and case Point(var x, _).
- APIsJEP 454
Foreign Function & Memory API
Call native code and manage off-heap memory without JNI.
- ToolsJEP 458
Multi-file source programs
java Main.java can use other source files.
- JVM & GCJEP 423
Region pinning for G1
No more GC stalls during JNI critical regions.
- Language
Java 23Sep 2024
Java 24Mar 2025
- APIsJEP 485
Stream gatherers
Custom intermediate operations: stream.gather(Gatherers.windowFixed(3)).
- APIsJEP 484
Class-File API
Read and write class files without ASM.
- JVM & GCJEP 491
Virtual threads no longer pin on synchronized
synchronized blocks no longer tie a virtual thread to its carrier.
- JVM & GCJEP 483
Ahead-of-time class loading and linking
Faster startup from a training run's cache.
- APIsJEP 496
Quantum-resistant cryptography
ML-KEM and ML-DSA.
- Removed / breakingJEP 486
Security Manager permanently disabled
Enabling it at startup or runtime fails.
- Removed / breakingJEP 479
Windows 32-bit x86 port removed
- APIs
Java 25LTSSep 2025
- LanguageJEP 512
Compact source files and instance main methods
void main() { IO.println("Hello"); } in a file without a class.
- LanguageJEP 511
Module import declarations
import module java.base; imports every package of a module.
- LanguageJEP 513
Flexible constructor bodies
Statements before super(…), e.g. to validate arguments.
- APIsJEP 506
Scoped values
Share immutable data with callees and child threads; the virtual-thread-friendly ThreadLocal.
- APIsJEP 510
Key Derivation Function API
- JVM & GCJEP 519
Compact object headers
Smaller object headers (-XX:+UseCompactObjectHeaders) cut heap use.
- JVM & GCJEP 515
AOT method profiling and simpler AOT cache creation
Faster warm-up from a training run.
- JVM & GCJEP 521
Generational Shenandoah
Production-ready.
- Removed / breakingJEP 503
32-bit x86 port removed
- Language
Compare Java 8, 11, 17, 21 and 25 features and changes.
How to use the Java Version Comparator
- Pick the Java version you run today and the one you're moving to, or click a common upgrade.
- Read the changes release by release. Filter by category, or show preview features too.
- Before upgrading, work through the Removed / breaking items: removed modules, stronger encapsulation and changed defaults.
What is an LTS release?
A new Java version ships every six months. Every two years one of them is a long-term support (LTS) release that vendors keep patching for years: Java 8, 11, 17, 21 and 25. Most teams move from one LTS to the next.
Frequently asked questions
What does "Unsupported class file major version 65" mean?
The class was compiled for a newer Java than the one running it (or than a tool such as an old Gradle or ASM supports). The class file version is the Java version plus 44, so 65 is Java 21. The Java Stack Trace Analyzer explains this and other errors.
What breaks most often when upgrading from Java 8?
JAXB and the other Java EE modules (removed in 11: add them as dependencies), libraries that use JDK internals (blocked since 16 and 17: upgrade them or add --add-opens) and old build plugins or bytecode tools that don't understand the new class file version.
Which features need --enable-preview?
Preview features must be switched on with --enable-preview both when compiling and when running, and can change in the next release. The list hides them by default; the release that made each one final lists it as usual.
Related tools
All tools- Java Stack Trace AnalyzerFind the root cause of a Java stack trace, what it means and how to fix it.
- Spring Boot Config GeneratorGenerate Spring Boot configuration for PostgreSQL, Redis, Kafka, Actuator, HikariCP and more.
- Maven Dependency HelperGenerate and format Maven dependency XML, parse coordinates and build Maven commands.
- Gradle Command HelperBuild common Gradle commands and flags.
- Java Stack Trace FormatterClean up Java stack traces, highlight application frames and find the root cause.