Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private Command generateCommandLine(Path nativeFolder) throws IOException {

Proxy.Type proxyType = options.getProxyType();
if (proxyType == null) {
res.addDefault("-Djava.net.useSystemProxies", "true");
res.addDefault("-Djava.net.useSystemProxies=", "true");
} else {
String proxyHost = options.getProxyHost();
int proxyPort = options.getProxyPort();
Expand All @@ -190,6 +190,33 @@ private Command generateCommandLine(Path nativeFolder) throws IOException {
}
}

try {
boolean hasIPv4 = false;
java.util.Enumeration<java.net.NetworkInterface> nets = java.net.NetworkInterface.getNetworkInterfaces();
while (nets != null && nets.hasMoreElements() && !hasIPv4) {
java.net.NetworkInterface nif = nets.nextElement();
try {
if (!nif.isUp() || nif.isLoopback()) continue;
} catch (Throwable ignore) {
// ignore and continue checking other interfaces
continue;
}
java.util.Enumeration<java.net.InetAddress> addrs = nif.getInetAddresses();
while (addrs.hasMoreElements()) {
java.net.InetAddress addr = addrs.nextElement();
if (addr instanceof java.net.Inet4Address && !addr.isLoopbackAddress()) {
hasIPv4 = true;
break;
}
}
}
if (hasIPv4) {
res.addDefault("-Djava.net.preferIPv4Stack=", "true");
}
} catch (java.net.SocketException e) {
LOG.warning("Failed to detect IPv4 address", e);
}

final int javaVersion = options.getJava().getParsedVersion();
final boolean is64bit = options.getJava().getBits() == Bits.BIT_64;

Expand Down