InetAddress.get*() vs RFC 6724

Daniel Fuchs daniel.fuchs at oracle.com
Tue Feb 10 14:34:20 UTC 2026


Hi Robert,

On 09/02/2026 10:59, Robert Stupp wrote:
>  > The default evaluated in InetAddress.initializePlatformLookupPolicy()
>  > yields 'IPV4_FIRST' to return IPv4 addresses before IPv6 addresses
>  > unless 'java.net.preferIPv6Addresses' is set to 'true'. I wonder
>  > whether this could be changed to the system default, relying on what
>  > 'getaddrinfo' returns?

This will not solve your issue if you have no way to pass
a system property through to the java command line, but note
that you can set `java.net.preferIPv6Addresses` to "system" if
you want to preserve the default ordering from `getaddrinfo`.

https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/net/doc-files/net-properties.html#java.net.preferIPv6Addresses


best regards,

-- daniel


More information about the net-dev mailing list