java.net.useSystemProxies
Java System Property accepts a boolean value (true
or false
)java.net.useSystemProxies
OverviewWhen set to true Java networking classes (java.net
) will attempt to use proxies defined by the operating system.
This property is supported on Windows, Mac OSX and on Linux when configured through Gnome 2.x.
The java.net.useSystemProxies property is only checked once during startup.
Here are some other networking Java system properties:
http.agent
http.keepAlive
http.maxConnections
https.protocols
java.net.preferIPv4Stack
java.net.preferIPv6Addresses
javax.net.debug
javax.net.ssl.trustStore
jdk.net.hosts.file
jdk.tls.client.protocols
jdk.tls.disabledAlgorithms
networkaddress.cache.negative.ttl
networkaddress.cache.ttl
sun.net.client.defaultConnectTimeout
sun.net.client.defaultReadTimeout
sun.net.inetaddr.ttl
Java has supported the java.net.useSystemProxies
system property since at least version 8, support may go back to even older versions of java.
java.net.useSystemProxies
on StartupYou can set the java.net.useSystemProxies
java system property during startup of the java runtime using the -D
command line argument:
java -Djava.net.useSystemProxies=true MyAppMain
You may also be able to specify java.net.useSystemProxies
via the JAVA_TOOL_OPTIONS
environment variable:
JAVA_TOOL_OPTIONS=-Djava.net.useSystemProxies=true
java.net.useSystemProxies
at RuntimeYou can set java.net.useSystemProxies at runtime with the following Java code:
System.setProperty("java.net.useSystemProxies", "true");
WARNING: Depending on the property and JVM version using
setProperty
may or may not work if the JDK Java class that uses this variable has already been loaded. The value of the java.net.useSystemProxies system property may be cached within an internal private static variable of the implementing class.
To read the value of java.net.useSystemProxies at runtime, you can use this Java code:
String propertyValue = System.getProperty("java.net.useSystemProxies"); if (propertyValue != null) { System.out.println("java.net.useSystemProxies = " + propertyValue); } else { System.out.println("java.net.useSystemProxies was null"); }