如何在 macOS 上禁用 Java 自动使用系统代理?

huangapple go评论99阅读模式
英文:

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

问题

我尝试设置export JAVA_TOOL_OPTIONS=' -Duser.language=en-US -Djava.net.useSystemProxies=false',但不起作用。

我的网络代理设置:
如何在 macOS 上禁用 Java 自动使用系统代理?

我使用手动下载的JDK,而不是系统内置的。

java -XshowSettings:properties -version 输出中,我们可以看到其中包含http.proxyHostsocksProxyHost

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)

相关问题:https://stackoverflow.com/questions/36847075/how-does-jvm-automatic-setting-of-os-xs-system-proxies-work

英文:

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

My network proxy setting:
如何在 macOS 上禁用 Java 自动使用系统代理?

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: https://stackoverflow.com/questions/36847075/how-does-jvm-automatic-setting-of-os-xs-system-proxies-work

答案1

得分: 2

只需使用 JAVA_TOOL_OPTIONS=-Dhttp.proxyHost= 来取消设置HTTP代理。您也可以对HTTPS执行相同操作。

英文:

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

huangapple
  • 本文由 发表于 2020年7月22日 10:37:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/63025945.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定