﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-Martin's Home-文章分类-J2SE</title><link>http://www.blogjava.net/martinyuan/category/28855.html</link><description /><language>zh-cn</language><lastBuildDate>Wed, 09 Jan 2008 19:35:16 GMT</lastBuildDate><pubDate>Wed, 09 Jan 2008 19:35:16 GMT</pubDate><ttl>60</ttl><item><title>在Java程序中设置代理服务器</title><link>http://www.blogjava.net/martinyuan/articles/174081.html</link><dc:creator>Martin Yuan</dc:creator><author>Martin Yuan</author><pubDate>Wed, 09 Jan 2008 10:22:00 GMT</pubDate><guid>http://www.blogjava.net/martinyuan/articles/174081.html</guid><wfw:comment>http://www.blogjava.net/martinyuan/comments/174081.html</wfw:comment><comments>http://www.blogjava.net/martinyuan/articles/174081.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/martinyuan/comments/commentRss/174081.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/martinyuan/services/trackbacks/174081.html</trackback:ping><description><![CDATA[在Java中设置代理的两种方式：<br /><span style="COLOR: #ff0000">（一）<span style="COLOR: #000000">在程序中调用代码如下：</span><br /></span><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="COLOR: #000000">Properties props </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> System.getProperties();<br />props.setProperty(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">proxySet</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">true</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br />props.setProperty(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">http.proxyHost</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">192.168.0.1</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br />props.setProperty(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">http.proxyPort</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">3128</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);</span></div><span style="COLOR: #ff0000">（二）<span style="COLOR: #040404">在jre安装目录的lib下有net.properties文件。对其进行设置</span><br /></span><br /><img src ="http://www.blogjava.net/martinyuan/aggbug/174081.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/martinyuan/" target="_blank">Martin Yuan</a> 2008-01-09 18:22 <a href="http://www.blogjava.net/martinyuan/articles/174081.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>