Currently, Inet6AddressImpl.loopbackAddress() will unconditionally choose the IPv6 loopback address if java.net.preferIPv6Address is set to "system" or "true", else unconditionally choose the IPv4 loopback address. Instead it should try out both loopback addresses and return whichever one works, giving preference to IPv6 if java.net.preferIPv6Address is set to "system" or "true", else giving preference to IPv4. This way there is no need to set java.net.preferIPv6Address in an IPv6-only environment to get a valid loopback address.