Works for me?
src/hc/core # cat Test.java
void main() {
var supportedOptions =
jdk.net.Sockets.supportedOptions(java.net.Socket.class);
IO.println("Supported Socket options: " + supportedOptions);
}
src/hc/core # mise exec java@corretto-25 -- java Test
Supported Socket options: [SO_KEEPALIVE, SO_RCVBUF, SO_REUSEPORT,
SO_SNDBUF, IP_TOS, TCP_KEEPCOUNT, TCP_KEEPINTERVAL, TCP_NODELAY,
SO_REUSEADDR, SO_LINGER, TCP_KEEPIDLE]
src/hc/core # mise exec java@temurin-jre-25 -- java Test
Supported Socket options: [SO_KEEPALIVE, SO_RCVBUF, SO_REUSEPORT,
SO_SNDBUF, IP_TOS, TCP_KEEPCOUNT, TCP_KEEPINTERVAL, TCP_NODELAY,
SO_REUSEADDR, SO_LINGER, TCP_KEEPIDLE]
Since `jdk.net` isn't developer tooling, there's no reason a JRE shouldn't
have it (contrast `jdk.compiler`). I think Gary's right, and whatever's
going on here has to do with Jigsaw, not the JDK/JRE distinction. It'd be
useful to have more info, such as the JVM invocation, the contents of
the --class-path versus the --module-path, whether passing `--add-modules
jdk.net` fixes the problem, etc.
On Mon, Jan 5, 2026 at 3:50 AM Oleg Kalnichevski <[email protected]> wrote:
> On Mon, 2026-01-05 at 11:13 +0000, Niels van Nieuwenburg wrote:
> > Hello,
> >
> > Apache HTTPClient5 version 5.5.2 introduced a dependency on the
> > 'jdk.net' module, calling jdk.net.Sockets and
> > jdk.net.ExtendedSocketOptions from
> > DefaultHttpClientConnectionOperator.
> > The commit which introduced this:
> >
> https://github.com/apache/httpcomponents-client/commit/9c83a8e43fb82467351a6d16b1ae78e0f6320873#diff-c8d113aa21d5fe2678c4c36f731cda6ed01d172d7e47e4d9fc527a5d4a921077R40-R41
> >
> > Since our applications are running using just the JRE, we get runtime
> > exceptions stating 'java.lang.NoClassDefFoundError: jdk/net/Sockets'
> > at deployment.<our
> > service>.war//org.apache.hc.client5.http.impl.io.DefaultHttpClientCon
> > nectionOperator.<clinit>(DefaultHttpClientConnectionOperator.java:85)
> > at deployment.<our
> > service>.war//org.apache.hc.client5.http.impl.io.BasicHttpClientConne
> > ctionManager.<init>(BasicHttpClientConnectionManager.java:207)
> >
> > We're running the Java 21 JRE, using Eclipse Temurin 21.0.9+10, on
> > WildFly 36.0.1.
> > When using the HTTPClient 5.5.1 everything still works properly.
> > Our tests run using the JDK, so they don't detect this.
> >
> > It would be great if this dependency can be removed.
> > Thank you in advance.
> >
>
> Hi Ryan
>
> Do you know if we have rendered our latest releases unusable with JRE
> in general by making them dependent on jdk.net or is this something
> that affects Eclipse Temurin and not Amazon Corretto?
>
>
> Oleg
>