java Java中如何获取系统HTTP代理配置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/226677/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to get the system HTTP proxy configuration in Java
提问by Auron
Is it possible to get the system proxy configuration in Java?
是否可以在 Java 中获取系统代理配置?
In the Java Control Panel, you can set a proxy configuration. How can I access to that proxy configuration in order to open URL connections behind a proxy?
在 Java 控制面板中,您可以设置代理配置。如何访问该代理配置以打开代理后面的 URL 连接?
采纳答案by Anton K
回答by ddimitrov
The Java Plugin gets it from the system settings. If the app has to be started as either applet or webstart you can use the webstart/applet APIs for this. Otherwise you have to use native code. Look at the various JniWrapper's WinPack and the JDIC libs - they might have done the heavy lifting for you.
Java 插件从系统设置中获取它。如果应用程序必须作为小程序或 webstart 启动,您可以为此使用 webstart/applet API。否则,您必须使用本机代码。查看各种 JniWrapper 的 WinPack 和 JDIC 库——它们可能已经为您完成了繁重的工作。

