Java 25 and Some of Its New Features

A Brief Description of Java 25 and Some of Its New Features

Posted by Byolio on September 19, 2025
🌐 中文 English

This article aims to describe Java 25 and some of its new features. Java 25 Windows download link: https://www.oracle.com/java/technologies/downloads/#jdk25-windows Java 25 documentation download link: https://www.oracle.com/java/technologies/javase-jdk25-doc-downloads.html

Introduction

On September 16th, following Java 21, another TLS version, Java 25, was released, bringing with it a large number of new features. Below is a brief description of some of the new features in Java 25.

Java 25 Finalized Features

core-libs

  1. New method: CharSequence.getChars(int, int, char[], int)
  2. New system property: stdin.encoding
  3. HttpClient: BodyHandlers.limiting / BodySubscribers.limiting
  4. HttpResponse.connectionLabel()
  5. ZIP File System support for accessMode=readOnly
  6. Inflater and Deflater implement AutoCloseable
  7. ForkJoinPool implements ScheduledExecutorService + new submitWithTimeout
  8. CompletableFuture/SubmissionPublisher uses commonPool asynchronously by default

JVM/HotSpot

  1. G1 GC shares G1CardSet to reduce remembered set overhead
  2. -XX:+UseCompactObjectHeaders becomes a finalized product option
  3. HotSpotDiagnosticMXBean.dumpThreads / jcmd Thread.dump_to_file supports lock information + JSON schema

JFR

  1. New @Contextual annotation

Security Libraries

  1. java.security.debug outputs thread/timestamp/call location by default
  2. SUN provider adds SHAKE128-256 / SHAKE256-512
  3. SunPKCS11 adds HKDF-SHA256/384/512
  4. jdk.tls.disabledAlgorithms supports disabling algorithms by TLS usage scenario
  5. TLS Keying Material Exporters (JSSE + SunJSSE)
  6. XML Security Library upgraded to Santuario 3.0.5, supports four SHA3-ECDSA algorithms

Tools

  1. jar –validate validation enhancements (duplicate entries, invalid paths, LOC/CEN inconsistencies, etc.)

Java 25 Preview/Incubator Features

  1. JEP 502: Stable Values (Preview)
  2. JEP 505: Structured Concurrency (Fifth Preview)
  3. JEP 506: Scoped Values (Finalized? → Needs confirmation: Standardized in Java 25, was preview in Java 24)
  4. JEP 507: Primitive Types in Patterns, instanceof, and switch (Third Preview)
  5. JEP 508: Vector API (Tenth Incubation)

Java 25 Removed Features

core-libs / java.net

1
2
3
4
5
java.net.Socket constructors
Two constructors accepting stream=false are deprecated; calling them will throw IllegalArgumentException
No longer allows creating DatagramSocket through them
Alternative: Use java.net.DatagramSocket
Will be completely removed in a future version

core-svc / javax.management

1
2
3
4
5
6
7
8
9
Removal of legacy JMX system properties
Deleted the following historical compatibility properties:
    jmx.extend.open.types
    jmx.invoke.getters
    jdk.jmx.mbeans.allowNonPublic
    jmx.mxbean.multiname
    jmx.tabular.data.hash.map
    jmx.remote.x.buffer.size (correct name is jmx.remote.x.notification.buffer.size)
These properties were originally only for transition and are now invalid

hotspot / runtime

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
PerfData sampling feature removed
Removed StatSampler
Removed parameter -XX:PerfDataSamplingInterval
Removed counter: sun.os.hrt.ticks (can use sun.rt.createVmBeginTime instead)
GC PerfData behavior change: Eden usage count is always 0
Alternative: Use Java Flight Recorder (JFR) or JMX

Legacy monitor performance counters sun.rt._sync*
Removed the following counters:
    _sync_ContendedLockAttempts
    _sync_FutileWakeups
    _sync_Parks
    _sync_Notifications
    _sync_Inflations
    _sync_Deflations
    _sync_MonExtant
Alternative: Use corresponding JFR events:
    JavaMonitorEnter
    JavaMonitorWait
    JavaMonitorNotify
    JavaMonitorInflate / JavaMonitorDeflate
    JavaMonitorStatistics

security-libs / java.security

1
2
3
4
5
6
Removal of expired root certificates
Baltimore CyberTrust Root
    alias: "baltimorecybertrustca [jdk]"
Camerfirma root certificates:
    "camerfirmachamberscommerceca [jdk]"
    "camerfirmachambersignca [jdk]"

security-libs / javax.crypto:pkcs11

1
2
3
4
5
6
7
8
Removal of SunPKCS11 Provider's PBE SecretKeyFactory implementation
Deleted the following algorithms:
    SecretKeyFactory.PBEWithHmac[MD]AndAES_128
    SecretKeyFactory.PBEWithHmac[MD]AndAES_256
    SecretKeyFactory.HmacPBE[MD]
[MD] includes: SHA1 / SHA224 / SHA256 / SHA384 / SHA512
Reason for removal: Inconsistent with SunJCE implementation, may cause interoperability issues
Alternative: Use the corresponding SunJCE implementation

Other

1
Official announcement and OpenJDK release notes state Java 25 formally "drops 32-bit support for x86". It no longer supports x86 32-bit platforms.

Mind Map

java25new