java设置代理
1: public void setProxy(){
2: Properties p = System.getProperties();
3: p.setProperty("proxySet","true");
4: p.setProperty("proxyHost","10.167.53.25");
5: p.setProperty("proxyPort","8080");
6: }
看到网上有如下代码,但是在我这里总是无法正确访问网络
1: private static void setProxy() {
2: System.getProperties().setProperty("proxySet", "true");
3: System.getProperties().setProperty("http.proxyHost", "10.167.65.23");
4: System.getProperties().setProperty("http.proxyPort", "8080");
5: }