我的java应用程序需要连接到互联网,我在代理服务器后面。我使用休眠函数来设置代理,但它不起作用?
System.getProperties().put("http.proxySet", "true");
System.getProperties().put("http.socksProxyHost", value);
System.getProperties().put("http.socksProxyPort", value);谢谢
发布于 2013-11-24 12:35:22
查看this question,特别是使用Proxy类的答案。
发布于 2013-11-24 12:36:58
检查系统参数名称。有两种方法可以做到这一点:
java -Dhttp.proxyHost=proxyhostURL -Dhttp.proxyPort=proxyPortNumber -Dhttp.proxyUser=userName -Dhttp.proxyPassword=password YourProgram
或者在代码中设置这些参数,如下所示
密码System.getProperties().put("http.proxyHost","proxyURL");System.getProperties().put("http.proxyPort","proxyPort");密码().put(“http.proxyUser”,"userName");System.getProperties().put("http.proxyPassword",“密码”);
https://stackoverflow.com/questions/20171077
复制相似问题