LoginSignup
1
0

More than 5 years have passed since last update.

Javaで接続時、IEで設定されたプロキシを使用方法まとめ

Last updated at Posted at 2018-06-16

java中如何设定,使程序可以自动使用IE设置好的代理访问HttpsUrlConnection

10几年前有人遇到和我一样的问题,而且解决了
https://community.oracle.com/message/7326510#7326510

尝试以下设置①

  1. 在系统属性中设置 System.setProperty("proxySet", "true");
  2. 在系统属性中设置 System.setProperty("java.net.UseSystemProxies", "true");
  3. IE中设置好代理
  4. 程序验证代理是否可用

如果设置①不可以,尝试改变注册表的值

  1. 在CurrentUser项目下找到:Software\Microsoft\Windows\CurrentVersion\Internet Settings设置项,确认以下三个属性的设置是否启用。
  2. ProxyEnable:0 ProxyHttp1.1:1 ProxyOverride:[127.0.0.1;] (我PC上设置值)

在jre/lib/net.properties中修改配置

  1. 修改文件中java.net.useSystemProxies=false 为true,默认使用系统代理
  2. 问题是在我启动项目时,根本没有加载这个文件

IE和eclipse上的代理设置都设置正确,java中仍然不使用这些代理的情况

  1. 这个情况下,主要问题是解决如何使java去寻找我们配置的各种代理(关键点)

(持续更新。。。。)

2018/06/16 update

- jdk java.net.UseSystemProxies属性使用bug https://bugs.java.com/view_bug.do?bug_id=6912868

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0