F566
F566

Reputation: 625

Java on macOS use system proxy automatically, how to disable it?

I try set export JAVA_TOOL_OPTIONS='-Duser.language=en-US -Djava.net.useSystemProxies=false', but not work.

My network proxy setting: enter image description here

I use manually downloaded JDK, not system builtin.

java -XshowSettings:properties -version output, we can see http.proxyHost, socksProxyHost in it:

Picked up JAVA_TOOL_OPTIONS: -Duser.language=en-US -Djava.net.useSystemProxies=false
Property settings:
    http.proxyHost = 127.0.0.1
    http.proxyPort = 7891
    https.proxyHost = 127.0.0.1
    https.proxyPort = 7891
    java.class.path =
    java.class.version = 58.0
    java.net.useSystemProxies = false
    jdk.debug = release
    line.separator = \n
    os.arch = x86_64
    os.name = Mac OS X
    os.version = 10.15.5
    java.home = /Users/xxx/code/jdk/jdk-14.0.2.jdk/Contents/Home
    path.separator = :
    socksProxyHost = 127.0.0.1
    socksProxyPort = 7891
    ......

java version "14.0.2" 2020-07-14
Java(TM) SE Runtime Environment (build 14.0.2+12-46)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.2+12-46, mixed mode, sharing)

Related question: How does JVM automatic setting of OS X's System proxies work?

Upvotes: 3

Views: 2026

Answers (1)

kigawas
kigawas

Reputation: 1258

Just simply use JAVA_TOOL_OPTIONS=-Dhttp.proxyHost= to unset the http proxy. You can do the same for https as well.

Upvotes: 2

Related Questions