How to force Java to use IPv4 instead IPv6?
Solution 1:
Put the options in _JAVA_OPTIONS
environment variable. How to do this is already described in various other posts – although they usually talk about setting PATH
, but it's all the same.
For example, on Linux, put the following in your ~/.profile
or ~/.bash_profile
:
export _JAVA_OPTIONS="-Djava.net.preferIPv4Stack=true"