如何在Java中获取系统HTTP代理配置[重复]

时间:2021-05-09 02:26:24

This question already has an answer here:

这个问题在这里已有答案:

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连接?

2 个解决方案

#1


3  

oh, just look at that question. there was a sample with a solution.

哦,看看那个问题吧。有一个解决方案的样本。

currently all samples I've seen use SUN's undocumented APIs (com.sum packages), which result in warnings at compile time...

目前我见过的所有样本都使用SUN的未记录的API(com.sum包),这会在编译时产生警告......

#2


1  

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插件从系统设置中获取它。如果应用程序必须以applet或webstart启动,则可以使用webstart / applet API。否则你必须使用本机代码。看看各种JniWrapper的WinPack和JDIC库 - 他们可能已经为你完成了繁重的工作。

#1


3  

oh, just look at that question. there was a sample with a solution.

哦,看看那个问题吧。有一个解决方案的样本。

currently all samples I've seen use SUN's undocumented APIs (com.sum packages), which result in warnings at compile time...

目前我见过的所有样本都使用SUN的未记录的API(com.sum包),这会在编译时产生警告......

#2


1  

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插件从系统设置中获取它。如果应用程序必须以applet或webstart启动,则可以使用webstart / applet API。否则你必须使用本机代码。看看各种JniWrapper的WinPack和JDIC库 - 他们可能已经为你完成了繁重的工作。