首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

java 程序署理设置

2012-10-26 
java 程序代理设置URL urlSystem.setProperty(http.proxyHost, 192.168.1.1)System.setProperty(ht

java 程序代理设置

URL url;System.setProperty("http.proxyHost", "192.168.1.1");System.setProperty("http.proxyPort", "3128");Authenticator.setDefault(new ProxyAuthenticator("name", "password"));try {url = new URL("http://download.oracle.com/javase/6/docs/technotes/guides/net/proxies.html");InputStream in = url.openStream();int i  = -1;while((i=in.read())>-1){System.out.print((char)i);}in.close();} catch (MalformedURLException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();}


参考资料:http://download.oracle.com/javase/6/docs/technotes/guides/net/proxies.html

热点排行