<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>久酷 &#187; java</title>
	<atom:link href="http://www.jiucool.com/cat/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jiucool.com</link>
	<description>Say That What I Can Say!</description>
	<lastBuildDate>Thu, 12 Jan 2012 23:09:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://www.jiucool.com/?pushpress=hub'/>
		<item>
		<title>Blackberry 开发教程</title>
		<link>http://www.jiucool.com/blackberry-development-tutorial/</link>
		<comments>http://www.jiucool.com/blackberry-development-tutorial/#comments</comments>
		<pubDate>Sat, 04 Sep 2010 15:58:27 +0000</pubDate>
		<dc:creator>久酷</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[blackberry 开发]]></category>
		<category><![CDATA[blackberry 开发入门]]></category>
		<category><![CDATA[blackberry 开发工具]]></category>
		<category><![CDATA[blackberry 开发指南]]></category>
		<category><![CDATA[blackberry 开发教程]]></category>
		<category><![CDATA[blackberry 开发语言]]></category>

		<guid isPermaLink="false">http://www.jiucool.com/blackberry-development-tutorial/</guid>
		<description><![CDATA[刚逛CSDN社区时发现了CSDN推出了blackberry开发系列教程，开发教程非常详细，大家需要的可以前往学习、开发之。

blackberry 开发系列教程地址是：http://subject.csdn.net/bbjc/



No related posts.





<span class="readmore"><a href="http://www.jiucool.com/blackberry-development-tutorial/" title="Blackberry 开发教程">Read More: 110 Words Totally</a></span>]]></description>
			<content:encoded><![CDATA[<p>刚逛CSDN社区时发现了CSDN推出了blackberry开发系列教程，开发教程非常详细，大家需要的可以前往学习、开发之。</p>
<p><a href="http://www.jiucool.com/tag/blackberry/" class="st_tag internal_tag" rel="tag" title="Posts tagged with BlackBerry">blackberry</a> 开发系列教程地址是：<a title="http://subject.csdn.net/bbjc/" href="http://subject.csdn.net/bbjc/" target="_blank">http://subject.csdn.net/bbjc/</a></p>
<p><a href="http://pic.jiucool.com/2010/09/blackberry2.jpg"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="blackberry 开发教程2" border="0" alt="blackberry 开发教程2" src="http://pic.jiucool.com/2010/09/blackberry2_thumb.jpg" width="554" height="620" /></a></p>
<p>No related posts.</p><br/>
<a href="http://www.jiucool.com/godaddy-domain" target="_blank"><img src="http://pic.jiucool.com/2010/godaddy_score_savings_468x60.jpg" /></a>
<hr />
<p><small>© 久酷 for <a href="http://www.jiucool.com">久酷</a>, 2010. |
<a href="http://www.jiucool.com/blackberry-development-tutorial/" target="_blank">Permalink</a> |
<a href="http://www.jiucool.com/blackberry-development-tutorial/#comments">16 comments</a> |
Twitter:
<a href="http://twitter.com/jiucool" target="_blank">@jiucool</a>
<br/>
Post tags: <a href="http://www.jiucool.com/tag/blackberry/" rel="tag">BlackBerry</a>, <a href="http://www.jiucool.com/tag/blackberry-%e5%bc%80%e5%8f%91/" rel="tag">blackberry 开发</a>, <a href="http://www.jiucool.com/tag/blackberry-%e5%bc%80%e5%8f%91%e5%85%a5%e9%97%a8/" rel="tag">blackberry 开发入门</a>, <a href="http://www.jiucool.com/tag/blackberry-%e5%bc%80%e5%8f%91%e5%b7%a5%e5%85%b7/" rel="tag">blackberry 开发工具</a>, <a href="http://www.jiucool.com/tag/blackberry-%e5%bc%80%e5%8f%91%e6%8c%87%e5%8d%97/" rel="tag">blackberry 开发指南</a>, <a href="http://www.jiucool.com/tag/blackberry-%e5%bc%80%e5%8f%91%e6%95%99%e7%a8%8b/" rel="tag">blackberry 开发教程</a>, <a href="http://www.jiucool.com/tag/blackberry-%e5%bc%80%e5%8f%91%e8%af%ad%e8%a8%80/" rel="tag">blackberry 开发语言</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://www.jiucool.com/blackberry-development-tutorial/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Java处理JSON数据错误解决办法</title>
		<link>http://www.jiucool.com/java-json-data-error-handling-solution/</link>
		<comments>http://www.jiucool.com/java-json-data-error-handling-solution/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 15:08:20 +0000</pubDate>
		<dc:creator>久酷</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[json-lib]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.jiucool.com/java-json-data-error-handling-solution/</guid>
		<description><![CDATA[json数据JS处理起来蛮方便，java处理起来的话我是用导入的Json-lib这个包，源码写好了，执行时总是报如下错误：



Exception in thread &#34;main&#34; java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException

at java.lang.ClassLoader.defineClass1&#40;Native Method&#41;

<span class="readmore"><a href="http://www.jiucool.com/java-json-data-error-handling-solution/" title="Java处理JSON数据错误解决办法">Read More: 1006 Words Totally</a></span>]]></description>
			<content:encoded><![CDATA[<p>json数据JS处理起来蛮方便，java处理起来的话我是用导入的Json-lib这个包，源码写好了，执行时总是报如下错误：</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #003399;">Exception</span> in thread <span style="color: #0000ff;">&quot;main&quot;</span> java.<span style="color: #006633;">lang</span>.<span style="color: #003399;">NoClassDefFoundError</span><span style="color: #339933;">:</span> org<span style="color: #339933;">/</span>apache<span style="color: #339933;">/</span>commons<span style="color: #339933;">/</span>lang<span style="color: #339933;">/</span>exception<span style="color: #339933;">/</span>NestableRuntimeException
at java.<span style="color: #006633;">lang</span>.<span style="color: #003399;">ClassLoader</span>.<span style="color: #006633;">defineClass1</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">Native</span> <span style="color: #003399;">Method</span><span style="color: #009900;">&#41;</span>
at java.<span style="color: #006633;">lang</span>.<span style="color: #003399;">ClassLoader</span>.<span style="color: #006633;">defineClass</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">ClassLoader</span>.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">620</span><span style="color: #009900;">&#41;</span>
at java.<span style="color: #006633;">security</span>.<span style="color: #003399;">SecureClassLoader</span>.<span style="color: #006633;">defineClass</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">SecureClassLoader</span>.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">124</span><span style="color: #009900;">&#41;</span>
at java.<span style="color: #006633;">net</span>.<span style="color: #003399;">URLClassLoader</span>.<span style="color: #006633;">defineClass</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">URLClassLoader</span>.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">260</span><span style="color: #009900;">&#41;</span>
at java.<span style="color: #006633;">net</span>.<span style="color: #003399;">URLClassLoader</span>.<span style="color: #006633;">access</span>$000<span style="color: #009900;">&#40;</span><span style="color: #003399;">URLClassLoader</span>.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">56</span><span style="color: #009900;">&#41;</span>
at java.<span style="color: #006633;">net</span>.<span style="color: #003399;">URLClassLoader</span>$1.<span style="color: #006633;">run</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">URLClassLoader</span>.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">195</span><span style="color: #009900;">&#41;</span>
at java.<span style="color: #006633;">security</span>.<span style="color: #003399;">AccessController</span>.<span style="color: #006633;">doPrivileged</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">Native</span> <span style="color: #003399;">Method</span><span style="color: #009900;">&#41;</span>
at java.<span style="color: #006633;">net</span>.<span style="color: #003399;">URLClassLoader</span>.<span style="color: #006633;">findClass</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">URLClassLoader</span>.<span style="color: #006633;">java</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">188</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>几经检查,程序没问题，原来是myeclipse的lib包有问题，主要是json-lib的dependencies 包缺少，依赖包一共如下几个，全部包含的话，OK搞定！(<a href="http://json-lib.sourceforge.net/" target="_blank">http://json-lib.sourceforge.net/</a>)&#160;
<p><a href="http://www.jiucool.com/tag/json-lib/" class="st_tag internal_tag" rel="tag" title="Posts tagged with json-lib">Json-lib</a> requires (at least) the following dependencies in your classpath:</p>
<ol>
<li>jakarta commons-lang 2.4 </li>
<li>jakarta commons-beanutils 1.7.0 </li>
<li>jakarta commons-collections 3.2 </li>
<li>jakarta commons-logging 1.1.1 </li>
<li>ezmorph 1.0.6</li>
</ol>
<p>打包下载地址：<a title="http://d.download.csdn.net/down/491113/luyi122333" href="http://d.download.csdn.net/down/491113/luyi122333" target="_blank">http://d.download.csdn.net/down/491113/luyi122333</a></p>
<p>No related posts.</p><br/>
<a href="http://www.jiucool.com/godaddy-domain" target="_blank"><img src="http://pic.jiucool.com/2010/godaddy_score_savings_468x60.jpg" /></a>
<hr />
<p><small>© 久酷 for <a href="http://www.jiucool.com">久酷</a>, 2010. |
<a href="http://www.jiucool.com/java-json-data-error-handling-solution/" target="_blank">Permalink</a> |
<a href="http://www.jiucool.com/java-json-data-error-handling-solution/#comments">15 comments</a> |
Twitter:
<a href="http://twitter.com/jiucool" target="_blank">@jiucool</a>
<br/>
Post tags: <a href="http://www.jiucool.com/tag/java/" rel="tag">java</a>, <a href="http://www.jiucool.com/tag/json/" rel="tag">json</a>, <a href="http://www.jiucool.com/tag/json-lib/" rel="tag">json-lib</a>, <a href="http://www.jiucool.com/tag/xml/" rel="tag">xml</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://www.jiucool.com/java-json-data-error-handling-solution/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Java发送http请求 (get 与 post方法请求)</title>
		<link>http://www.jiucool.com/java-sending-http-requests-get-and-post-method-request/</link>
		<comments>http://www.jiucool.com/java-sending-http-requests-get-and-post-method-request/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 16:00:00 +0000</pubDate>
		<dc:creator>久酷</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[get]]></category>
		<category><![CDATA[Http]]></category>
		<category><![CDATA[HttpURLConnection用法]]></category>
		<category><![CDATA[http请求]]></category>
		<category><![CDATA[post]]></category>

		<guid isPermaLink="false">http://www.jiucool.com/java-sending-http-requests-get-and-post-method-request/</guid>
		<description><![CDATA[Java发送http请求 (get 与 post方法请求)，以下代码经本人亲自调试可用！可以直接使用之。

 注意：通过BufferedReader 读取远程返回的数据时，必须设置读取编码，否则中文会乱码！





package com.jiucool.www.struts.action;

&#160;

<span class="readmore"><a href="http://www.jiucool.com/java-sending-http-requests-get-and-post-method-request/" title="Java发送http请求 (get 与 post方法请求)">Read More: 4712 Words Totally</a></span>]]></description>
			<content:encoded><![CDATA[<p>Java发送http请求 (<a href="http://www.jiucool.com/tag/get/" class="st_tag internal_tag" rel="tag" title="Posts tagged with get">get</a> 与 post方法请求)，以下代码经本人亲自调试可用！可以直接使用之。
<p /> 注意：通过BufferedReader 读取远程返回的数据时，必须设置读取编码，否则中文会乱码！
<p />

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.jiucool.www.struts.action</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.BufferedReader</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.DataOutputStream</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.File</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.FileReader</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.InputStreamReader</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.HttpURLConnection</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.URL</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.URLEncoder</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> post_request <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> GET_URL <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://www.jiucool.com/request.php?key=j0r56u2&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> POST_URL <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://www.jiucool.com/request.php&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> readContentFromGet<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">IOException</span><span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// 拼凑get请求的URL字串，使用URLEncoder.encode对特殊和不可见字符进行编码</span>
        <span style="color: #003399;">String</span> getURL <span style="color: #339933;">=</span> GET_URL <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;&amp;activatecode=&quot;</span> <span style="color: #339933;">+</span> <span style="color: #003399;">URLEncoder</span>.<span style="color: #006633;">encode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;久酷博客&quot;</span>, <span style="color: #0000ff;">&quot;utf-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">URL</span> getUrl <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">URL</span><span style="color: #009900;">&#40;</span>getURL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// 根据拼凑的URL，打开连接，URL.openConnection函数会根据URL的类型，</span>
        <span style="color: #666666; font-style: italic;">// 返回不同的URLConnection子类的对象，这里URL是一个http，因此实际返回的是HttpURLConnection</span>
        <span style="color: #003399;">HttpURLConnection</span> connection <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">HttpURLConnection</span><span style="color: #009900;">&#41;</span> getUrl
                .<span style="color: #006633;">openConnection</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// 进行连接，但是实际上get request要在下一句的connection.getInputStream()函数中才会真正发到</span>
        <span style="color: #666666; font-style: italic;">// 服务器</span>
        connection.<span style="color: #006633;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// 取得输入流，并使用Reader读取</span>
        <span style="color: #003399;">BufferedReader</span> reader <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">BufferedReader</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">InputStreamReader</span><span style="color: #009900;">&#40;</span>connection.<span style="color: #006633;">getInputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,<span style="color: #0000ff;">&quot;utf-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//设置编码,否则中文乱码</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;=============================&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Contents of get request&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;=============================&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">String</span> lines<span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>lines <span style="color: #339933;">=</span> reader.<span style="color: #006633;">readLine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        	<span style="color: #666666; font-style: italic;">//lines = new String(lines.getBytes(), &quot;utf-8&quot;);</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>lines<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        reader.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// 断开连接</span>
        connection.<span style="color: #006633;">disconnect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;=============================&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Contents of get request ends&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;=============================&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> readContentFromPost<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">IOException</span><span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// Post请求的url，与get不同的是不需要带参数</span>
        <span style="color: #003399;">URL</span> postUrl <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">URL</span><span style="color: #009900;">&#40;</span>POST_URL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// 打开连接</span>
        <span style="color: #003399;">HttpURLConnection</span> connection <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">HttpURLConnection</span><span style="color: #009900;">&#41;</span> postUrl
                .<span style="color: #006633;">openConnection</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// Output to the connection. Default is</span>
        <span style="color: #666666; font-style: italic;">// false, set to true because post</span>
        <span style="color: #666666; font-style: italic;">// method must write something to the</span>
        <span style="color: #666666; font-style: italic;">// connection</span>
        <span style="color: #666666; font-style: italic;">// 设置是否向connection输出，因为这个是post请求，参数要放在</span>
        <span style="color: #666666; font-style: italic;">// http正文内，因此需要设为true</span>
        connection.<span style="color: #006633;">setDoOutput</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// Read from the connection. Default is true.</span>
        connection.<span style="color: #006633;">setDoInput</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// Set the post method. Default is GET</span>
        connection.<span style="color: #006633;">setRequestMethod</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;POST&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// Post cannot use caches</span>
        <span style="color: #666666; font-style: italic;">// Post 请求不能使用缓存</span>
        connection.<span style="color: #006633;">setUseCaches</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// This method takes effects to</span>
        <span style="color: #666666; font-style: italic;">// every instances of this class.</span>
        <span style="color: #666666; font-style: italic;">// URLConnection.setFollowRedirects是static函数，作用于所有的URLConnection对象。</span>
        <span style="color: #666666; font-style: italic;">// connection.setFollowRedirects(true);</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// This methods only</span>
        <span style="color: #666666; font-style: italic;">// takes effacts to this</span>
        <span style="color: #666666; font-style: italic;">// instance.</span>
        <span style="color: #666666; font-style: italic;">// URLConnection.setInstanceFollowRedirects是成员函数，仅作用于当前函数</span>
        connection.<span style="color: #006633;">setInstanceFollowRedirects</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// Set the content type to urlencoded,</span>
        <span style="color: #666666; font-style: italic;">// because we will write</span>
        <span style="color: #666666; font-style: italic;">// some URL-encoded content to the</span>
        <span style="color: #666666; font-style: italic;">// connection. Settings above must be set before connect!</span>
        <span style="color: #666666; font-style: italic;">// 配置本次连接的Content-type，配置为application/x-www-form-urlencoded的</span>
        <span style="color: #666666; font-style: italic;">// 意思是正文是urlencoded编码过的form参数，下面我们可以看到我们对正文内容使用URLEncoder.encode</span>
        <span style="color: #666666; font-style: italic;">// 进行编码</span>
        connection.<span style="color: #006633;">setRequestProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span>,
                <span style="color: #0000ff;">&quot;application/x-www-form-urlencoded&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// 连接，从postUrl.openConnection()至此的配置必须要在connect之前完成，</span>
        <span style="color: #666666; font-style: italic;">// 要注意的是connection.getOutputStream会隐含的进行connect。</span>
        connection.<span style="color: #006633;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">DataOutputStream</span> out <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">DataOutputStream</span><span style="color: #009900;">&#40;</span>connection
                .<span style="color: #006633;">getOutputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// The URL-encoded contend</span>
        <span style="color: #666666; font-style: italic;">// 正文，正文内容其实跟get的URL中'?'后的参数字符串一致</span>
        <span style="color: #003399;">String</span> content <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;key=j0r53nmbbd78x7m1pqml06u2&amp;type=1&amp;toemail=jiucool@gmail.com&quot;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;&amp;activatecode=&quot;</span> <span style="color: #339933;">+</span> <span style="color: #003399;">URLEncoder</span>.<span style="color: #006633;">encode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;久酷博客&quot;</span>, <span style="color: #0000ff;">&quot;utf-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// DataOutputStream.writeBytes将字符串中的16位的unicode字符以8位的字符形式写道流里面</span>
        out.<span style="color: #006633;">writeBytes</span><span style="color: #009900;">&#40;</span>content<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
        out.<span style="color: #006633;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        out.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// flush and close</span>
        <span style="color: #003399;">BufferedReader</span> reader <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">BufferedReader</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">InputStreamReader</span><span style="color: #009900;">&#40;</span>connection.<span style="color: #006633;">getInputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,<span style="color: #0000ff;">&quot;utf-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//设置编码,否则中文乱码</span>
        <span style="color: #003399;">String</span> line<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;=============================&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Contents of post request&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;=============================&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>line <span style="color: #339933;">=</span> reader.<span style="color: #006633;">readLine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #666666; font-style: italic;">//line = new String(line.getBytes(), &quot;utf-8&quot;);</span>
            <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>line<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;=============================&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Contents of post request ends&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;=============================&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        reader.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        connection.<span style="color: #006633;">disconnect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>HttpURLConnection.connect函数，实际上只是建立了一个与服务器的tcp连接，并没有实际发送http请求。无论是post还是get，http请求实际上直到HttpURLConnection.getInputStream()这个函数里面才正式发送出去。</p>
<p>在readContentFromPost() 中，顺序是重中之重，对connection对象的一切配置（那一堆set函数）都必须要在connect()函数执行之前完成。而对 outputStream的写操作，又必须要在inputStream的读操作之前。这些顺序实际上是由http请求的格式决定的。</p>
<p><a href="http://www.jiucool.com/tag/http/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Http">http</a> 请求实际上由两部分组成，一个是http头，所有关于此次http请求的配置都在http头里面定义，一个是正文content，在connect()函数里面，会根据HttpURLConnection对象的配置值生成http头，因此在调用connect函数之前，就必须把所有的配置准备好。</p>
<p>紧接着http头的是http请求的正文，正文的内容通过outputStream写入，实际上outputStream不是一个网络流，充其量是个字符串流，往里面写入的东西不会立即发送到网络，而是在流关闭后，根据输入的内容生成http正文。</p>
<p>至此，http请求的东西已经准备就绪。在getInputStream()函数调用的时候，就会把准备好的http请求正式发送到服务器了，然后返回一个输入流，用于读取服务器对于此次http请求的返回信息。由于http请求在getInputStream的时候已经发送出去了（包括http头和正文），因此在getInputStream()函数之后对connection对象进行设置（对http头的信息进行修改）或者写入 outputStream（对正文进行修改）都是没有意义的了，执行这些操作会导致异常的发生。<br />
来自：<a href="http://blog.csdn.net/pandazxx/archive/2007/06/18/1657109.aspx" target="_blank">pandazxx CSDN</a></p>
<p>No related posts.</p><br/>
<a href="http://www.jiucool.com/godaddy-domain" target="_blank"><img src="http://pic.jiucool.com/2010/godaddy_score_savings_468x60.jpg" /></a>
<hr />
<p><small>© 久酷 for <a href="http://www.jiucool.com">久酷</a>, 2010. |
<a href="http://www.jiucool.com/java-sending-http-requests-get-and-post-method-request/" target="_blank">Permalink</a> |
<a href="http://www.jiucool.com/java-sending-http-requests-get-and-post-method-request/#comments">16 comments</a> |
Twitter:
<a href="http://twitter.com/jiucool" target="_blank">@jiucool</a>
<br/>
Post tags: <a href="http://www.jiucool.com/tag/get/" rel="tag">get</a>, <a href="http://www.jiucool.com/tag/http/" rel="tag">Http</a>, <a href="http://www.jiucool.com/tag/httpurlconnection%e7%94%a8%e6%b3%95/" rel="tag">HttpURLConnection用法</a>, <a href="http://www.jiucool.com/tag/http%e8%af%b7%e6%b1%82/" rel="tag">http请求</a>, <a href="http://www.jiucool.com/tag/java/" rel="tag">java</a>, <a href="http://www.jiucool.com/tag/post/" rel="tag">post</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://www.jiucool.com/java-sending-http-requests-get-and-post-method-request/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>JAVA 打开文件乱码 解决办法</title>
		<link>http://www.jiucool.com/java-file-unreadable-code-open-solution/</link>
		<comments>http://www.jiucool.com/java-file-unreadable-code-open-solution/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 16:00:00 +0000</pubDate>
		<dc:creator>久酷</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[BufferedReader]]></category>
		<category><![CDATA[乱码]]></category>

		<guid isPermaLink="false">http://www.jiucool.com/java-file-unreadable-code-open-solution/</guid>
		<description><![CDATA[有些问题有时很奇怪，也很让人恼火，GBK、GB2312是什么编码，当然是汉字编码喽，而常常汉字编码不认识汉字，是不是让人恼火呢？

 下面这部分代码的意思是打开D盘目录下的file_jiucool.txt文件 ，然后在控制台将其内容输出！





String Data_Path = &#34;D:/file_jiucool.txt&#34;;

		File file = new File&#40;Data_Path&#41;;

<span class="readmore"><a href="http://www.jiucool.com/java-file-unreadable-code-open-solution/" title="JAVA 打开文件乱码 解决办法">Read More: 963 Words Totally</a></span>]]></description>
			<content:encoded><![CDATA[<p>有些问题有时很奇怪，也很让人恼火，GBK、GB2312是什么编码，当然是汉字编码喽，而常常汉字编码不认识汉字，是不是让人恼火呢？
<p /> 下面这部分代码的意思是打开D盘目录下的file_jiucool.txt文件 ，然后在控制台将其内容输出！
<p />

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #003399;">String</span> Data_Path <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;D:/file_jiucool.txt&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">File</span> file <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">File</span><span style="color: #009900;">&#40;</span>Data_Path<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> line<span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>file.<span style="color: #006633;">exists</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>		
			<span style="color: #003399;">FileReader</span> reader <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">FileReader</span><span style="color: #009900;">&#40;</span>Data_Path<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
			<span style="color: #003399;">BufferedReader</span> bufferedreader<span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">BufferedReader</span><span style="color: #009900;">&#40;</span>reader<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>line <span style="color: #339933;">=</span> bufferedreader.<span style="color: #006633;">readLine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">!=</span><span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
					line <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#40;</span>line.<span style="color: #006633;">getBytes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, <span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>line<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span></pre></div></div>

<p>上述代码中，设置为GBK、GB2312 时全部为乱码，设置为UTF-8时，最后一个汉字为乱码，是不是很让人郁闷？正确代码如下：
<p />

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #003399;">String</span> Data_Path <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;D:/file_jiucool.txt&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">File</span> file <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">File</span><span style="color: #009900;">&#40;</span>Data_Path<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> line<span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>file.<span style="color: #006633;">exists</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>		
			<span style="color: #666666; font-style: italic;">//FileReader reader = new FileReader(Data_Path);	</span>
			<span style="color: #666666; font-style: italic;">//BufferedReader bufferedreader= new BufferedReader(reader);</span>
			<span style="color: #003399;">InputStreamReader</span> isr <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">InputStreamReader</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">FileInputStream</span><span style="color: #009900;">&#40;</span>file<span style="color: #009900;">&#41;</span>, <span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003399;">BufferedReader</span> bufferedreader <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">BufferedReader</span><span style="color: #009900;">&#40;</span>isr<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">while</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>line <span style="color: #339933;">=</span> bufferedreader.<span style="color: #006633;">readLine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">!=</span><span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
					<span style="color: #666666; font-style: italic;">//line = new String(line.getBytes(), &quot;UTF-8&quot;);</span>
					<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>line<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span></pre></div></div>

<p>所以，在读取文件的时候就得进行编码设置，而不是读完文件输出时再设置编码！</p>
<p>No related posts.</p><br/>
<a href="http://www.jiucool.com/godaddy-domain" target="_blank"><img src="http://pic.jiucool.com/2010/godaddy_score_savings_468x60.jpg" /></a>
<hr />
<p><small>© 久酷 for <a href="http://www.jiucool.com">久酷</a>, 2010. |
<a href="http://www.jiucool.com/java-file-unreadable-code-open-solution/" target="_blank">Permalink</a> |
<a href="http://www.jiucool.com/java-file-unreadable-code-open-solution/#comments">6 comments</a> |
Twitter:
<a href="http://twitter.com/jiucool" target="_blank">@jiucool</a>
<br/>
Post tags: <a href="http://www.jiucool.com/tag/bufferedreader/" rel="tag">BufferedReader</a>, <a href="http://www.jiucool.com/tag/java/" rel="tag">java</a>, <a href="http://www.jiucool.com/tag/%e4%b9%b1%e7%a0%81/" rel="tag">乱码</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://www.jiucool.com/java-file-unreadable-code-open-solution/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Java 与 PHP 发送get请求并获取远程内容</title>
		<link>http://www.jiucool.com/java-php-get-remote-doget-method-content/</link>
		<comments>http://www.jiucool.com/java-php-get-remote-doget-method-content/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 16:00:00 +0000</pubDate>
		<dc:creator>久酷</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[doget请求]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[调用远程内容]]></category>

		<guid isPermaLink="false">http://www.jiucool.com/?p=8266</guid>
		<description><![CDATA[既然两种语言都玩，就有得对比了，先看JAVA实现，再来看PHP，当然实现的方法有很多种特别是JAVA对于同一种功能的实现绝对比PHP多很多，这点是毫无疑问的！

JAVA实现方法一：



package com.jiucool.www.struts.action;

&#160;

import java.io.BufferedReader;

<span class="readmore"><a href="http://www.jiucool.com/java-php-get-remote-doget-method-content/" title="Java 与 PHP 发送get请求并获取远程内容">Read More: 971 Words Totally</a></span>]]></description>
			<content:encoded><![CDATA[<p>既然两种语言都玩，就有得对比了，先看JAVA实现，再来看PHP，当然实现的方法有很多种特别是JAVA对于同一种功能的实现绝对比PHP多很多，这点是毫无疑问的！</p>
<p>JAVA实现方法一：</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.jiucool.www.struts.action</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.BufferedReader</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.InputStreamReader</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.MalformedURLException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.URL</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.URLConnection</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> doget_http_request<span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> doget_http_request<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #003399;">StringBuffer</span> readOneLineBuff <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">StringBuffer</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003399;">String</span> content <span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">URL</span> url <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">URL</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://www.jiucool.com/sendemail.php?key=j0r53nmbbd78x7m1&quot;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;&amp;activatecode=2QyiF0SXXTq8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">URLConnection</span> conn <span style="color: #339933;">=</span> url.<span style="color: #006633;">openConnection</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">BufferedReader</span> reader <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">BufferedReader</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">InputStreamReader</span><span style="color: #009900;">&#40;</span>conn.<span style="color: #006633;">getInputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>		
		<span style="color: #003399;">String</span> line <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>line <span style="color: #339933;">=</span> reader.<span style="color: #006633;">readLine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			readOneLineBuff.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span>line<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		 content <span style="color: #339933;">=</span> readOneLineBuff.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		reader.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">MalformedURLException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IOException</span> e2<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		e2.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>	
	<span style="color: #000000; font-weight: bold;">return</span> content<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>对于PHP的实现，简单得让人要跳楼，看代码：
<p />

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://www.jiucool.com/sendemail.php?key=j0r53nmbbd78x7m1&amp;activatecode=2QyiF0SXXTq8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>PHP实在太简单了！不过有一点，PHP的弱类型语言让人实在有点不习惯，变量不声明即可使用，太不严谨了！</p>
<p>No related posts.</p><br/>
<a href="http://www.jiucool.com/godaddy-domain" target="_blank"><img src="http://pic.jiucool.com/2010/godaddy_score_savings_468x60.jpg" /></a>
<hr />
<p><small>© 久酷 for <a href="http://www.jiucool.com">久酷</a>, 2010. |
<a href="http://www.jiucool.com/java-php-get-remote-doget-method-content/" target="_blank">Permalink</a> |
<a href="http://www.jiucool.com/java-php-get-remote-doget-method-content/#comments">3 comments</a> |
Twitter:
<a href="http://twitter.com/jiucool" target="_blank">@jiucool</a>
<br/>
Post tags: <a href="http://www.jiucool.com/tag/doget%e8%af%b7%e6%b1%82/" rel="tag">doget请求</a>, <a href="http://www.jiucool.com/tag/java/" rel="tag">java</a>, <a href="http://www.jiucool.com/tag/php-2/" rel="tag">php</a>, <a href="http://www.jiucool.com/tag/%e8%b0%83%e7%94%a8%e8%bf%9c%e7%a8%8b%e5%86%85%e5%ae%b9/" rel="tag">调用远程内容</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://www.jiucool.com/java-php-get-remote-doget-method-content/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Java 与 PHP 的MD5加密方法</title>
		<link>http://www.jiucool.com/java-and-phps-md5-encryption/</link>
		<comments>http://www.jiucool.com/java-and-phps-md5-encryption/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 02:27:37 +0000</pubDate>
		<dc:creator>久酷</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[java md5加密]]></category>
		<category><![CDATA[md5]]></category>
		<category><![CDATA[md5加密]]></category>

		<guid isPermaLink="false">http://www.jiucool.com/?p=8236</guid>
		<description><![CDATA[不得不说java要比复杂很多很多，包括相关配置，使用以及具体开发方面！对于PHP 你自学几天就可以写东西了，但对于java有点难度！

最近写的代码，同时用到了php 与java，来看看其MD5加密方法：

java里MD5没有现成的方法，只得自己写一个，如下：



public static String EncoderByMd5&#40;String str&#41;&#123;

		if&#40;isNull&#40;str&#41;&#41;&#123;

<span class="readmore"><a href="http://www.jiucool.com/java-and-phps-md5-encryption/" title="Java 与 PHP 的MD5加密方法">Read More: 470 Words Totally</a></span>]]></description>
			<content:encoded><![CDATA[<p>不得不说java要比复杂很多很多，包括相关配置，使用以及具体开发方面！对于PHP 你自学几天就可以写东西了，但对于java有点难度！</p>
<p>最近写的代码，同时用到了php 与java，来看看其MD5加密方法：</p>
<p>java里MD5没有现成的方法，只得自己写一个，如下：</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> EncoderByMd5<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> str<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>isNull<span style="color: #009900;">&#40;</span>str<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000000; font-weight: bold;">try</span><span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">//确定计算方法</span>
			<span style="color: #003399;">MessageDigest</span> md5<span style="color: #339933;">=</span> <span style="color: #003399;">MessageDigest</span>.<span style="color: #006633;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;MD5&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			BASE64Encoder base64en <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> BASE64Encoder<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">//加密后的字符串</span>
			<span style="color: #003399;">String</span> newstr<span style="color: #339933;">=</span>base64en.<span style="color: #006633;">encode</span><span style="color: #009900;">&#40;</span>md5.<span style="color: #006633;">digest</span><span style="color: #009900;">&#40;</span>str.<span style="color: #006633;">getBytes</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;utf-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">return</span> newstr.<span style="color: #006633;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">return</span> str.<span style="color: #006633;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span></pre></div></div>

<p><a href="http://www.jiucool.com/tag/php-2/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">php</a> MD5加密非常简单直接这样就可以了：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>差别与难易程度确实有点大！</p>
<p>No related posts.</p><br/>
<a href="http://www.jiucool.com/godaddy-domain" target="_blank"><img src="http://pic.jiucool.com/2010/godaddy_score_savings_468x60.jpg" /></a>
<hr />
<p><small>© 久酷 for <a href="http://www.jiucool.com">久酷</a>, 2010. |
<a href="http://www.jiucool.com/java-and-phps-md5-encryption/" target="_blank">Permalink</a> |
<a href="http://www.jiucool.com/java-and-phps-md5-encryption/#comments">8 comments</a> |
Twitter:
<a href="http://twitter.com/jiucool" target="_blank">@jiucool</a>
<br/>
Post tags: <a href="http://www.jiucool.com/tag/java/" rel="tag">java</a>, <a href="http://www.jiucool.com/tag/java-md5%e5%8a%a0%e5%af%86/" rel="tag">java md5加密</a>, <a href="http://www.jiucool.com/tag/md5/" rel="tag">md5</a>, <a href="http://www.jiucool.com/tag/md5%e5%8a%a0%e5%af%86/" rel="tag">md5加密</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://www.jiucool.com/java-and-phps-md5-encryption/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Java 上传文件过程及清空相关缓存目录</title>
		<link>http://www.jiucool.com/java-upload-process-and-empty-the-cache-directory-associated/</link>
		<comments>http://www.jiucool.com/java-upload-process-and-empty-the-cache-directory-associated/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 07:25:10 +0000</pubDate>
		<dc:creator>久酷</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[上传文件]]></category>
		<category><![CDATA[清空子目录]]></category>
		<category><![CDATA[清空文件]]></category>

		<guid isPermaLink="false">http://www.jiucool.com/?p=8200</guid>
		<description><![CDATA[一个类+几个方法,写过一次的东西，就要记录下来，以后可以方便的使用！



	//提交注册3 &#38;&#38; 上传相关图片

public ActionForward reg_enterprise_3&#40;ActionMapping mapping, ActionForm form,

		HttpServletRequest request, HttpServletResponse response&#41;

<span class="readmore"><a href="http://www.jiucool.com/java-upload-process-and-empty-the-cache-directory-associated/" title="Java 上传文件过程及清空相关缓存目录">Read More: 1728 Words Totally</a></span>]]></description>
			<content:encoded><![CDATA[<p>一个类+几个方法,写过一次的东西，就要记录下来，以后可以方便的使用！</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">	<span style="color: #666666; font-style: italic;">//提交注册3 &amp;&amp; 上传相关图片</span>
<span style="color: #000000; font-weight: bold;">public</span> ActionForward reg_enterprise_3<span style="color: #009900;">&#40;</span>ActionMapping mapping, ActionForm form,
		HttpServletRequest request, HttpServletResponse response<span style="color: #009900;">&#41;</span>
		<span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">IOException</span>, ServletException <span style="color: #009900;">&#123;</span>
	UserInfo userinfo <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>UserInfo<span style="color: #009900;">&#41;</span>request.<span style="color: #006633;">getSession</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;willRegUser&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">int</span> uid <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">getUserInfoService</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">insert</span><span style="color: #009900;">&#40;</span>userinfo<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003399;">String</span> mark <span style="color: #339933;">=</span> StringUtils.<span style="color: #006633;">getParameter</span><span style="color: #009900;">&#40;</span>request, <span style="color: #0000ff;">&quot;mark&quot;</span>, <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;jump_jiucool&quot;</span>.<span style="color: #006633;">equalsIgnoreCase</span><span style="color: #009900;">&#40;</span>mark<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		ActionForward gotourl <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ActionForward<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		gotourl.<span style="color: #006633;">setPath</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/reg_enterprise4.jsp);
		gotourl.setRedirect(true);
		return gotourl;
	}
	CookieUtils.setCookie(request, response, &quot;</span>umobile_jiucool<span style="color: #0000ff;">&quot;, userinfo.getMsisdn(),60*60*24*30);
	CookieUtils.setCookie(request, response, &quot;</span>uemail_jiucool<span style="color: #0000ff;">&quot;, userinfo.getEmail(),60*60*24*30);
	CookieUtils.setCookie(request, response, &quot;</span>uid_jiucool<span style="color: #0000ff;">&quot;, String.valueOf(userinfo.getId()),60*60*24*30);
	request.getSession().setAttribute(Constants.USER_SESSION, new SessionUser(userinfo.getId()));
	String tempFilePath = Constants.PIC_UPLOAD_PATH + &quot;</span>enterprisePic<span style="color: #339933;">/</span>temp<span style="color: #0000ff;">&quot; + &quot;</span><span style="color: #339933;">/</span><span style="color: #0000ff;">&quot;;
	try {
		File file = new File(tempFilePath);
		if(!file.exists()){
			file.mkdirs();
		}
		DiskFileItemFactory factory = new DiskFileItemFactory();
		factory.setSizeThreshold(4*1024);
		factory.setRepository(new File(tempFilePath));
		ServletFileUpload upload = new ServletFileUpload(factory);
		upload.setSizeMax(4*1024*1024);
		List items = upload.parseRequest(request);
		Iterator iter = items.iterator();
		Integer type=0;
		while(iter.hasNext()){
			FileItem item = (FileItem)iter.next();
			String filename = item.getFieldName();
			if(filename.equalsIgnoreCase(&quot;</span>uploadface<span style="color: #0000ff;">&quot;)){
				type=1;
			}else if(filename.equalsIgnoreCase(&quot;</span>uploadidcard<span style="color: #0000ff;">&quot;)){
				type=2;
			}			
			if(!item.isFormField()){
				this.processUploadedFile(item, userinfo, type);
			}
		}
		Boolean flag = true;
		 File dirFile = new File(tempFilePath);     	       
		  File[] files = dirFile.listFiles();     
		        for(int i=0;i&lt;files.length;i++){     
		             //删除子文件     
		             if(files[i].isFile()){     
		                 flag = deleteFile(files[i].getAbsolutePath());     
		                 if(!flag){     
		                     break;     
		                 }     
		             }     
		             //删除子目录     
		             else{     
		                 flag = deleteDirectory(files[i].getAbsolutePath());     
		                 if(!flag){     
		                     break;     
		                 }     
		             }     
		         }     
	}catch(Exception e){
		throw new ServletException(e);
	}	
	ActionForward gotourl = new ActionForward();
	gotourl.setPath(&quot;</span><span style="color: #339933;">/</span>reg_enterprise4.<span style="color: #006633;">jsp</span><span style="color: #339933;">?</span>uid<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot; + userinfo.getId());
	gotourl.setRedirect(true);
	return gotourl;
}
private void processUploadedFile(FileItem item,UserInfo userinfo,Integer type) throws Exception{
	String filename = item.getName();
	int index=filename.lastIndexOf(&quot;</span>\\<span style="color: #0000ff;">&quot;);
	filename = filename.substring(index+1, filename.length());
	long fileSize = item.getSize();
	if(filename.equals(&quot;</span><span style="color: #0000ff;">&quot;) &amp;&amp; fileSize ==0)return;
	String suffixName =  item.getName().substring(
			 item.getName().lastIndexOf(&quot;</span>.<span style="color: #0000ff;">&quot;));
	if(&quot;</span>.<span style="color: #006633;">png</span><span style="color: #0000ff;">&quot;.equalsIgnoreCase(suffixName) || &quot;</span>.<span style="color: #006633;">jpg</span><span style="color: #0000ff;">&quot;.equalsIgnoreCase(suffixName)
			|| &quot;</span>.<span style="color: #006633;">gif</span><span style="color: #0000ff;">&quot;.equalsIgnoreCase(suffixName) || &quot;</span>.<span style="color: #006633;">jpeg</span><span style="color: #0000ff;">&quot;.equalsIgnoreCase(suffixName)){
		// 数据库存入路径					
		filename = System.currentTimeMillis() + suffixName;
&nbsp;
		String adFileName =&quot;</span><span style="color: #0000ff;">&quot;;
		if(type==1){
			 adFileName = StringUtils.replaceChar(userinfo.getId()*11,&quot;</span><span style="color: #339933;">-</span><span style="color: #0000ff;">&quot;) + &quot;</span><span style="color: #339933;">/</span><span style="color: #0000ff;">&quot; + DateUtils.format(&quot;</span>yyyMMdd<span style="color: #0000ff;">&quot;, new Date()) + &quot;</span><span style="color: #339933;">/</span><span style="color: #0000ff;">&quot;;
			 FileUtils.saveFileStream(item.getInputStream(),Constants.FACE_UPLOAD_PATH , adFileName + filename);
				userinfo.setFace(&quot;</span><span style="color: #339933;">/</span><span style="color: #0000ff;">&quot; + adFileName + filename);
				this.getUserInfoService().update(userinfo);
		}else if(type==2){
			 adFileName = &quot;</span>enterprisePic<span style="color: #339933;">/</span><span style="color: #0000ff;">&quot; + &quot;</span>idcard<span style="color: #0000ff;">&quot; + &quot;</span><span style="color: #339933;">/</span><span style="color: #0000ff;">&quot; + DateUtils.format(&quot;</span>yyyMMdd<span style="color: #0000ff;">&quot;, new Date()) + &quot;</span><span style="color: #339933;">/</span><span style="color: #0000ff;">&quot;;
			userinfo.setComidcard(adFileName + filename);				
		}else if(type==3){
			 adFileName = &quot;</span>enterprisePic<span style="color: #339933;">/</span><span style="color: #0000ff;">&quot; + &quot;</span>comlicense<span style="color: #0000ff;">&quot; + &quot;</span><span style="color: #339933;">/</span><span style="color: #0000ff;">&quot; + DateUtils.format(&quot;</span>yyyMMdd<span style="color: #0000ff;">&quot;, new Date()) + &quot;</span><span style="color: #339933;">/</span><span style="color: #0000ff;">&quot;;
				userinfo.setComlicense(adFileName + filename);
			}
			if(type&gt;1){
				this.getUserInfoService().update(userinfo);
				FileUtils.saveFileStream(item.getInputStream(),Constants.PIC_UPLOAD_PATH,adFileName + filename);
			}
		}
	}
  /**   
   * 删除单个文件   
   * @param   fileName    被删除文件的文件名   
   * @return 单个文件删除成功返回true,否则返回false   
   */    
  public static boolean deleteFile(String fileName){     
      File file = new File(fileName);     
      if(file.isFile() &amp;&amp; file.exists()){     
          file.delete();     
      return true;     
  }else{     
          return false;     
      }     
  }     
&nbsp;
  /**   
   * 删除目录（文件夹）以及目录下的文件   
   * @param   dir 被删除目录的文件路径   
   * @return  目录删除成功返回true,否则返回false   
   */    
  public static boolean deleteDirectory(String dir){     
      //如果dir不以文件分隔符结尾，自动添加文件分隔符     
  if(!dir.endsWith(File.separator)){     
      dir = dir+File.separator;     
  }     
  File dirFile = new File(dir);     
  //如果dir对应的文件不存在，或者不是一个目录，则退出     
  if(!dirFile.exists() || !dirFile.isDirectory()){     
      System.out.println(&quot;</span>删除目录失败<span style="color: #0000ff;">&quot;+dir+&quot;</span>目录不存在！<span style="color: #0000ff;">&quot;);     
      return false;     
  }     
  boolean flag = true;     
  //删除文件夹下的所有文件(包括子目录)     
  File[] files = dirFile.listFiles();     
  for(int i=0;i&lt;files.length;i++){     
      //删除子文件     
  if(files[i].isFile()){     
      flag = deleteFile(files[i].getAbsolutePath());     
      if(!flag){     
          break;     
      }     
  }     
  //删除子目录     
      else{     
          flag = deleteDirectory(files[i].getAbsolutePath());     
          if(!flag){     
              break;     
          }     
      }     
  }     
&nbsp;
  if(!flag){     
      System.out.println(&quot;</span>删除目录失败<span style="color: #0000ff;">&quot;);     
      return false;     
  }     
&nbsp;
  //删除当前目录     
  if(dirFile.delete()){     
      System.out.println(&quot;</span>删除目录<span style="color: #0000ff;">&quot;+dir+&quot;</span>成功！<span style="color: #0000ff;">&quot;);     
      return true;     
  }else{     
      System.out.println(&quot;</span>删除目录<span style="color: #0000ff;">&quot;+dir+&quot;</span>失败！<span style="color: #0000ff;">&quot;);     
          return false;     
      }     
  }</span></pre></div></div>

<p>No related posts.</p><br/>
<a href="http://www.jiucool.com/godaddy-domain" target="_blank"><img src="http://pic.jiucool.com/2010/godaddy_score_savings_468x60.jpg" /></a>
<hr />
<p><small>© 久酷 for <a href="http://www.jiucool.com">久酷</a>, 2010. |
<a href="http://www.jiucool.com/java-upload-process-and-empty-the-cache-directory-associated/" target="_blank">Permalink</a> |
<a href="http://www.jiucool.com/java-upload-process-and-empty-the-cache-directory-associated/#comments">3 comments</a> |
Twitter:
<a href="http://twitter.com/jiucool" target="_blank">@jiucool</a>
<br/>
Post tags: <a href="http://www.jiucool.com/tag/java/" rel="tag">java</a>, <a href="http://www.jiucool.com/tag/%e4%b8%8a%e4%bc%a0%e6%96%87%e4%bb%b6/" rel="tag">上传文件</a>, <a href="http://www.jiucool.com/tag/%e6%b8%85%e7%a9%ba%e5%ad%90%e7%9b%ae%e5%bd%95/" rel="tag">清空子目录</a>, <a href="http://www.jiucool.com/tag/%e6%b8%85%e7%a9%ba%e6%96%87%e4%bb%b6/" rel="tag">清空文件</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://www.jiucool.com/java-upload-process-and-empty-the-cache-directory-associated/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Java数据库连接池lookup用法</title>
		<link>http://www.jiucool.com/java-lookup/</link>
		<comments>http://www.jiucool.com/java-lookup/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 00:41:00 +0000</pubDate>
		<dc:creator>久酷</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[应用相关]]></category>
		<category><![CDATA[lookup]]></category>

		<guid isPermaLink="false">http://www.jiucool.com/java-lookup/</guid>
		<description><![CDATA[大项目用框架相对方便些，小一点项目还是不要用框架了太过复杂！

非框架时引用数据源我们一般这样：

Context ctx = new InitialContext(); 

DataSource ds = (DataSource)ctx.lookup(“java:comp/env/jdbc/MysqlDb”);

但看到有的地方是直接这样写的：

DataSource ds = (DataSource)ctx.lookup(“jdbc/MysqlDb”);

<span class="readmore"><a href="http://www.jiucool.com/java-lookup/" title="Java数据库连接池lookup用法">Read More: 787 Words Totally</a></span>]]></description>
			<content:encoded><![CDATA[<p>大项目用框架相对方便些，小一点项目还是不要用框架了太过复杂！</p>
<p>非框架时引用数据源我们一般这样：</p>
<p><code>Context ctx = new InitialContext(); </code></p>
<p><code>DataSource ds = (DataSource)ctx.<a href="http://www.jiucool.com/tag/lookup/" class="st_tag internal_tag" rel="tag" title="Posts tagged with lookup">lookup</a>(“<a href="http://www.jiucool.com/tag/java/" class="st_tag internal_tag" rel="tag" title="Posts tagged with java">java</a>:comp/env/jdbc/MysqlDb”);</code></p>
<p>但看到有的地方是直接这样写的：</p>
<p><code>DataSource ds = (DataSource)ctx.lookup(“jdbc/MysqlDb”);</code></p>
<p>到底有啥区别？</p>
<p>java:comp/env 是环境命名上下文（environment naming context（ENC）），是在EJB规范1.1以后引入的，引入这个是为了解决原来JNDI查找所引起的冲突问题，也是为了提高EJB或者J2EE应用的移植性。</p>
<p>ENC是一个引用，引用是用于定位企业应用程序的外部资源的逻辑名。引用是在应用程序部署描述符文件中定义的。在部署时，引用被绑定到目标可操作环境中资源的物理位置（JNDI名）。使用ENC是把对其它资源的JNDI查找的硬编码解脱出来，通过配置这个引用可以在不修改代码的情况下，将引用指向不同的EJB(JNDI)。 在J2EE中的引用常用的有：</p>
<p>&#8212;&#8212;&#8212;JDBC 数据源引用在java:comp/env/jdbc 子上下文中声明<br />
&#8212;&#8212;&#8212;JMS 连接工厂在java:comp/env/jms 子上下文中声明<br />
&#8212;&#8212;&#8212;JavaMail 连接工厂在java:comp/env/mail 子上下文中声明<br />
&#8212;&#8212;&#8212;URL 连接工厂在 java:comp/env/url子上下文中声明</p>
<p>所以我们还是应该这样写更加规范： <code>Context ctx = new InitialContext(); </code></p>
<p><code>DataSource ds = (DataSource)ctx.lookup(“java:comp/env/jdbc/MysqlDb”);</code></p>
<p>No related posts.</p><br/>
<a href="http://www.jiucool.com/godaddy-domain" target="_blank"><img src="http://pic.jiucool.com/2010/godaddy_score_savings_468x60.jpg" /></a>
<hr />
<p><small>© 久酷 for <a href="http://www.jiucool.com">久酷</a>, 2010. |
<a href="http://www.jiucool.com/java-lookup/" target="_blank">Permalink</a> |
<a href="http://www.jiucool.com/java-lookup/#comments">3 comments</a> |
Twitter:
<a href="http://twitter.com/jiucool" target="_blank">@jiucool</a>
<br/>
Post tags: <a href="http://www.jiucool.com/tag/java/" rel="tag">java</a>, <a href="http://www.jiucool.com/tag/lookup/" rel="tag">lookup</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://www.jiucool.com/java-lookup/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Java 的未来非常乐观</title>
		<link>http://www.jiucool.com/the-future-of-java-optimistic/</link>
		<comments>http://www.jiucool.com/the-future-of-java-optimistic/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 12:47:49 +0000</pubDate>
		<dc:creator>久酷</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[互联网络]]></category>
		<category><![CDATA[java未来]]></category>
		<category><![CDATA[java的未来]]></category>

		<guid isPermaLink="false">http://www.jiucool.com/the-future-of-java-optimistic/</guid>
		<description><![CDATA[Java的未来非常乐观,是不是同时意味着,搞Java的人前途也乐观了?? ^_^&#8230;&#8230;&#8230;&#8230;关注身边的事,关注切身相关的事.HOHO….

干一行,爱一行,既然从事了这行,就好好干,不要再三心二意了,认真研究java就好.从一、专一!

 

美国时间 2010 年 3 月 17 日，在 Oracle 收购 Sun Microsystems 之后，Java 之父 James Gosling 首度在公开场合露面，并表示 Java 在 Oracle 的掌管下令人放心。

<span class="readmore"><a href="http://www.jiucool.com/the-future-of-java-optimistic/" title="Java 的未来非常乐观">Read More: 1150 Words Totally</a></span>]]></description>
			<content:encoded><![CDATA[<p>Java的未来非常乐观,是不是同时意味着,搞Java的人前途也乐观了?? ^_^&#8230;&#8230;&#8230;&#8230;关注身边的事,关注切身相关的事.HOHO….</p>
<p>干一行,爱一行,既然从事了这行,就好好干,不要再三心二意了,认真研究java就好.从一、专一!</p>
<p><a href="http://pic.jiucool.com/2010/03/JamesGosling.jpg" target="_blank"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="James-Gosling" border="0" alt="James-Gosling" src="http://pic.jiucool.com/2010/03/JamesGosling_thumb.jpg" width="454" height="342" /></a> </p>
<p>美国时间 2010 年 3 月 17 日，在 Oracle 收购 Sun Microsystems 之后，<a href="http://www.jiucool.com/tag/java/" class="st_tag internal_tag" rel="tag" title="Posts tagged with java">Java</a> 之父 James Gosling 首度在公开场合露面，并表示 <a href="http://www.jiucool.com/tag/java/" class="st_tag internal_tag" rel="tag" title="Posts tagged with java">Java</a> 在 Oracle 的掌管下令人放心。</p>
<p>在甲骨文试图收购 Sun 之前，IBM 被看作 Sun 最合适的收购者，而这桩收购也颇受争议并且过程一波三折。但是 Sun 被甲骨文接管却无论对 Java 还是 IT 业界都是十分有益的。</p>
<p>众所周知，Java 是 Sun 最重要的业务，Sun 甚至曾将自己的股票代号由 SUN 改为 JAVA，而 Java 至今还是世界上最流行的语言之一。在 Sun 没落尤其是被甲骨文收购之后，各种媒体上出现了很多认为 Java 已经穷途末路的评论。这次 Java 之父的表态，可以看作是对这种言论的一种回应。</p>
<p>在我看来，Java 在甲骨文手中将会有很好的发展。</p>
<h2>三大原因有利 Java 发展</h2>
<h3>1. 甲骨文将会继续发展 Java</h3>
<p>甲骨文自己的数据库产品中就大量使用了 Java 技术，甲骨文有充分的动力继续优化发展 Java。事实上，甲骨文收购 Sun，很大一部分原因就是为了得到 Java。在甲骨文雄厚财力的支持下，Java 的技术进步会更加快速。</p>
<h3>2. 甲骨文会继续促进 Java 平台的开放</h3>
<p>很多人将 Sun 的没落归咎于 Java 平台的开放，担心甲骨文会使 Java 平台封闭以限制其竞争对手 IBM 的发展，而后者也恰恰大量使用了 Java 技术。这种担心是多余的。Java 作为一门基于虚拟机的编程语言，其地位一直收到后来的 Python，C#等的挑战，将它的实现平台封闭起来将会极大限制它的竞争力。另外，IBM，Google 都有自己的Java 实现。封闭平台十分困难且对竞争对手的打击非常有限。</p>
<h3>3. 甲骨文将会给 Java 注入极大活力</h3>
<p>现阶段 Java 的薄弱点在于其桌面端应用，这与 Sun 的经营方向有很大的关系。在 Sun 市值缩水之后再想要在桌面端有所作为则一直心有余而力不足。甲骨文很可能在这一方面大作文章。想当年 Java 之所以能让 Sun 荣耀一时，就是因为业界看出 Java 有可能架空微软的 Windows 平台，打破其平台优势，与微软分庭抗礼。但是由于种种原因，这个目标没有实现，Sun 也因此沦落到被收购的地步。甲骨文恰可以接过接力棒，完成 Sun 未能完成的事业。这对甲骨文来说也是有益的，甲骨文一直有踏足桌面应用、扩展业务范围的主观需要，这将可能带给甲骨文新的利润点。</p>
<p><strong>总之，甲骨文接管 Java 不但不会使 Java 没落，反而会使他迎来一个新的历史机遇。</strong></p>
<p><strong>后部分原文:<a title="http://www.techxav.cn/2010/03/22/java-will-have-a-better-future/" href="http://www.techxav.cn/2010/03/22/java-will-have-a-better-future/" target="_blank">http://www.techxav.cn/</a></strong></p>
<p>No related posts.</p><br/>
<a href="http://www.jiucool.com/godaddy-domain" target="_blank"><img src="http://pic.jiucool.com/2010/godaddy_score_savings_468x60.jpg" /></a>
<hr />
<p><small>© 久酷 for <a href="http://www.jiucool.com">久酷</a>, 2010. |
<a href="http://www.jiucool.com/the-future-of-java-optimistic/" target="_blank">Permalink</a> |
<a href="http://www.jiucool.com/the-future-of-java-optimistic/#comments">16 comments</a> |
Twitter:
<a href="http://twitter.com/jiucool" target="_blank">@jiucool</a>
<br/>
Post tags: <a href="http://www.jiucool.com/tag/java%e6%9c%aa%e6%9d%a5/" rel="tag">java未来</a>, <a href="http://www.jiucool.com/tag/java%e7%9a%84%e6%9c%aa%e6%9d%a5/" rel="tag">java的未来</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://www.jiucool.com/the-future-of-java-optimistic/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Windows 下整合tomcat + apache配置</title>
		<link>http://www.jiucool.com/tomcat-apache-integration/</link>
		<comments>http://www.jiucool.com/tomcat-apache-integration/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 10:58:54 +0000</pubDate>
		<dc:creator>久酷</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[应用相关]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[tomcat-apache整合]]></category>

		<guid isPermaLink="false">http://www.jiucool.com/tomcat-apache-integration/</guid>
		<description><![CDATA[整合apache+tomcat &#8211; 实现的主要功能是如果是jsp和java servlet等动态资源就交由tomcat处理，静态页面则交由于apache 处理.达到负载均衡.

Apache的HTTPD是目前比较受欢迎的网站服务器软件，它不但功能强大，而且完全免费，并且支持市场上流行的各种操作系统(Windows,Linux,Mac os)。同时对于Java Servlet/JSP的支持，通常也会使用同样Apache出品的Tomcat。

<span class="readmore"><a href="http://www.jiucool.com/tomcat-apache-integration/" title="Windows 下整合tomcat + apache配置">Read More: 4050 Words Totally</a></span>]]></description>
			<content:encoded><![CDATA[<p>整合apache+<a href="http://www.jiucool.com/tag/tomcat/" class="st_tag internal_tag" rel="tag" title="Posts tagged with tomcat">tomcat</a> &#8211; 实现的主要功能是如果是jsp和java servlet等动态资源就交由tomcat处理，静态页面则交由于apache 处理.达到负载均衡.</p>
<p>Apache的HTTPD是目前比较受欢迎的网站服务器软件，它不但功能强大，而且完全免费，并且支持市场上流行的各种操作系统(Windows,Linux,Mac os)。同时对于Java Servlet/JSP的支持，通常也会使用同样Apache出品的Tomcat。<br />
Tomcat除了支持Java Servlet/JSP之外，也可以当做网站服务器使用，但是在对于静态的html文件、图片文件等的解析效率上不如Apache HTTPD的执行效率高。应用tomcat的服务器如果网站的访问量较大，系统资源占用会明显升高，近日笔者在项目执行过程中遇到这一问题，便也想到同时应用tomcat+apache服务。Apache负责静态资源处理，tomcat负责jsp和java servlet等动态资源的处理。</p>
<p><strong>下面为当前最新服务器软件(2010-3-4)</strong></p>
<p>准备工作：</p>
<p>1、  apache 2.2.14<br />
下载地址：<a title="http://labs.renren.com/apache-mirror/httpd/binaries/win32/apache_2.2.14-win32-x86-no_ssl.msi" href="http://labs.renren.com/apache-mirror/httpd/binaries/win32/apache_2.2.14-win32-x86-no_ssl.msi">http://labs.renren.com/apache-mirror/httpd/binaries/win32/apache_2.2.14-win32-x86-no_ssl.msi</a></p>
<p>2、  Tomcat 6.0<br />
下载地址：<a title="http://tomcat.apache.org/download-60.cgi" href="http://tomcat.apache.org/download-60.cgi">http://tomcat.apache.org/download-60.cgi</a></p>
<p>3、  <a href="http://www.jiucool.com/tag/jdk/" class="st_tag internal_tag" rel="tag" title="Posts tagged with jdk">JDK</a> 1.6.0 update6<br />
下载地址：<a title="http://cds-esd.sun.com/ESD6/JSCDL/jre/6u18-b79/jdk-6u18-windows-i586.exe?AuthParam=1267591733_04eced74758b8f13153f2ae17d8489c2&amp;TicketId=CJ0lg5rMlzOGw5HtXokNAgA%3D&amp;GroupName=CDS&amp;FilePath=/ESD6/JSCDL/jre/6u18-b79/jdk-6u18-windows-i586.exe&amp;File=jdk-6u18-windows-i586.exe" href="http://cds-esd.sun.com/ESD6/JSCDL/jre/6u18-b79/jdk-6u18-windows-i586.exe?AuthParam=1267591733_04eced74758b8f13153f2ae17d8489c2&amp;TicketId=CJ0lg5rMlzOGw5HtXokNAgA%3D&amp;GroupName=CDS&amp;FilePath=/ESD6/JSCDL/jre/6u18-b79/jdk-6u18-windows-i586.exe&amp;File=jdk-6u18-windows-i586.exe">http://cds-esd.sun.com/ESD6/JSCDL/jre/6u18-b79/jdk-6u18-windows-i586.exe?AuthParam=1267591733_04eced74758b8f13153f2ae17d8489c2&amp;TicketId=CJ0lg5rMlzOGw5HtXokNAgA%3D&amp;GroupName=CDS&amp;FilePath=/ESD6/JSCDL/jre/6u18-b79/jdk-6u18-windows-i586.exe&amp;File=jdk-6u18-windows-i586.exe</a></p>
<p>4、JK- apachemod_jk-1.2.28-httpd-2.2.3.so<br />
下载地址：<br />
<a title="http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.28/mod_jk-1.2.28-httpd-2.2.3.so" href="http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.28/mod_jk-1.2.28-httpd-2.2.3.so">http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.28/mod_jk-1.2.28-httpd-2.2.3.so</a><br />
注意jk的版本一定要与你的apache版本相同。Jk下载可以直接到apache.org官网下载，有多种版本，适用于各种操作系统，地址如下：<br />
<a href="http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/">http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/</a><br />
windows 用户进入win32目录，不同的tomcat对应不同jk文件扩展名不同，有可能是*.dll,或者*.so，根据你的tomcat版本下载合适的jk版本。<br />
安装，软件的安装顺序可以适当调整，但是jre(jdk)一定要在tomcat之前安装：<br />
1、安装JRE(JDK)<br />
此处选择默认安装即可，(旧版本的JDK安装完之后需要设置系统的环境变量，JRE和JDK1.5.0以后版本不设置也没关系。)安装完成之后你可以选择按照下面的示例设置你的系统环境变量：我的电脑-&gt;右键属性-&gt;常规-&gt;高级-&gt;环境变量<br />
JAVA_HOME = D:\Java\jdk1.6.0_18<br />
CLASSPATH =.;D:\Java\<a href="http://www.jiucool.com/tag/jre/" class="st_tag internal_tag" rel="tag" title="Posts tagged with jre">jre</a>6\lib\tools.jar<br />
PATH = D:\Java\jre6\bin<br />
注意文件路径要改成你实际安装的路径。<br />
2、Apache安装<br />
此处注意，如果你本机已经装了iis并且占用80端口,务必先在服务中将iis停止或禁用。软件默认安装即可。安装过程中设置Network Domain和Server Name为localhost,设置你的email地址，下方会让你选择only for the current user或for all users。我选择only for the current user。这样Apache就会占用8080端口，并且做为一个系统服务开机自运行。<br />
安装完成之后，你在浏览器中输入http://localhost,将会看到Apache的成功页面.Apache的主目录是d:\Apache \Apache2,此时Apache,已经运行,你可以在窗口的托盘看到他的图标,双击图标，在弹开的窗口选择&#8221;Open Apache Monitor&#8221;,点Stop，停止Apaceh服务，因为下面要安装Tomcat和JK.</p>
<p>PS.如果遇到apache安装后无可用服务时,可以参考前面这篇文章<a href="http://www.jiucool.com/apache-server/" target="_blank">Apache安装后里面无服务解决办法</a><br />
3、Tomcat安装<br />
选择安装目录为了d:\Tomcat,其余为默认安装.更改端口号为8081,以名与apache冲突,成功后在浏览器中输入http://localhost:80801,出现Tomcat页面表示安装成功了。关于 tomcat的设置已经有很多非常详细的文章，在此就不再详述了。<br />
4、JK的安装<br />
把emod_jk-1.2.28-httpd-2.2.3.so 拷贝到 d:\Apache\Apache2\modules\下.<br />
以上安装全部完成后,打开cmd命令提示符,运行d:\Apache \Apache2\bin\Apache.exe -t 你将会看到&#8221;Syntax OK&#8221;，表示Apache配置正常．这个命令非常有用，下面在继续配置Apache的时候还会再次用到。<br />
配置服务器：<br />
1、配置Tomcat<br />
查找目录下的conf/workers.properties文件，并对比下方文本内容，如有不同以下方内容为准修改。</p>
<p>workers.tomcat_home=D:\Program Files\Apache Software Foundation\Tomcat 6.0\ #让mod_jk模块知道Tomcat的位置<br />
workers.java_home=D:\Java\jre6 #让mod_jk模块知道jre的位置<br />
ps=\<br />
worker.list=ajp13 #模块版本<br />
worker.ajp13.port=8009 #工作端口,若没占用则不用修改<br />
worker.ajp13.host=localhost #本机,若上面的Apache主机不为localhost,作相应修改<br />
worker.ajp13.type=ajp13 #类型<br />
worker.ajp13.lbfactor=1 #代理数,不用修改</p>
<p>如果文件不存在则创建。并填充上述内容。<br />
2、配置Apache<br />
打开d:\Apache \Apache2\conf下的httpd.conf，在最后加入下面这段代码并保存。<br />
#设置Apache与Tomcat之间的连接，让 Apache遇到jsp文件时，在后台将其交由Tomcat去处理<br />
LoadModule jk_module modules\mod_jk-1.2.28-httpd-2.2.3.so<br />
#此处mod_jk的文件为你下载的文件<br />
JkWorkersFile &#8220;d:/Tomcat/conf/workers.properties&#8221;<br />
#指定tomcat监听配置文件地址<br />
JkLogFile &#8220;d:/Tomcat/logs/mod_jk2.log&#8221;<br />
#指定日志存放位置<br />
JkLogLevel info<br />
#设置虚拟主机</p>
<pre>
ServerAdmin admin.molei.net
DocumentRoot D:\Users\Jiucool\workspace\leisns\wapmanager
#您的站点项目所在路径，应与tomcat中的目录设置相同
ServerName admin.molei.net
DirectoryIndex index.html index.htm index.jsp
ErrorLog logs/shsc-error_log.txt
CustomLog logs/shsc-access_log.txt common
JkMount /servlet/* ajp13
#让Apache支持对servlet传送，用以Tomcat解析
JkMount /*.jsp ajp13
#让Apache支持对jsp传送，用以Tomcat解析
JkMount /*.do ajp13
#让 Apache支持对.do传送，用以Tomcat解析
JkMount /*.me ajp13
</pre>
<p># 开头的行为注释，可以删除。此处的配置我是以设置虚拟目录，重新指定了serverName,DocumentRoot路径的方式配置站点，实际上，Apache的配置可以非常灵活，你也可以不采用虚拟目录的方式，而直接去修改站点的默认配置，使用任意文本编辑工具，搜索如 ServerName,DocumentRoot,ServerAdmin等相关项，然后将该项的配置根据你的实际情况进行修改即可。我建议大家可以多多尝试不同的配置，这是一种很有乐趣的体验。</p>
<p>所有的修改完成这后，再次执行d:\server\Apache2\bin\Apache.exe -t 如果看到&#8221;Syntax OK&#8221;，说明你所有配置无误，双击窗口的托盘中的图标，然后点击Start运行。</p>
<p>在地址栏中分别输入 http://localhos:8080/，与http://localhost:8081/若结果相同,Apache与Tomcat整合成功能</p>
<p>PS. 可能默认访问apache情况会出现403拒绝页面,可以将下面代码修改:</p>
<pre>
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    deny from all
</pre>
<p>修改为:</p>
<pre>
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all
</pre>
<p>就可以正常访问了.</p>
<p>参考:(<a href="http://www.cjsdn.net/post/view?bid=11&amp;id=172565" target="_blank">java开发网</a>)</p>
<p>No related posts.</p><br/>
<a href="http://www.jiucool.com/godaddy-domain" target="_blank"><img src="http://pic.jiucool.com/2010/godaddy_score_savings_468x60.jpg" /></a>
<hr />
<p><small>© 久酷 for <a href="http://www.jiucool.com">久酷</a>, 2010. |
<a href="http://www.jiucool.com/tomcat-apache-integration/" target="_blank">Permalink</a> |
<a href="http://www.jiucool.com/tomcat-apache-integration/#comments">18 comments</a> |
Twitter:
<a href="http://twitter.com/jiucool" target="_blank">@jiucool</a>
<br/>
Post tags: <a href="http://www.jiucool.com/tag/apache/" rel="tag">Apache</a>, <a href="http://www.jiucool.com/tag/tomcat/" rel="tag">tomcat</a>, <a href="http://www.jiucool.com/tag/tomcat-apache%e6%95%b4%e5%90%88/" rel="tag">tomcat-apache整合</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://www.jiucool.com/tomcat-apache-integration/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>久酷最近购置的两本书</title>
		<link>http://www.jiucool.com/two-books/</link>
		<comments>http://www.jiucool.com/two-books/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 13:15:19 +0000</pubDate>
		<dc:creator>久酷</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[心情随笔]]></category>
		<category><![CDATA[lamp开发]]></category>
		<category><![CDATA[web开发]]></category>

		<guid isPermaLink="false">http://www.jiucool.com/two-books/</guid>
		<description><![CDATA[真是N久没买书了,记得上次买书是买的那本名叫《名博是怎样炼成的》的书！不知大家看过否？

前两天购买了两天书，一本是《LAMP网站开发黄金组合:Linux+Apache+MySQL+PHP(附光盘1张) 》另一本书是《Tomcat与Java Web开发技术详解(第2版)(附CD-ROM光盘1张)》，第一本书是出于业余爱好想研究下，第二本书是与本职工作有关。



 

刚开始在网上选书时看书内容也没多少，拿到手后，吓了一跳，每本书都不止新华字典那么厚，书太大，太厚，出门就有点不方便携带！

<span class="readmore"><a href="http://www.jiucool.com/two-books/" title="久酷最近购置的两本书">Read More: 474 Words Totally</a></span>]]></description>
			<content:encoded><![CDATA[<p>真是N久没买书了,记得上次买书是买的那本名叫《名博是怎样炼成的》的书！不知大家看过否？</p>
<p>前两天购买了两天书，一本是《LAMP网站开发黄金组合:Linux+<a href="http://www.jiucool.com/tag/apache/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Apache">Apache</a>+MySQL+<a href="http://www.jiucool.com/tag/php-2/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php">PHP</a>(附光盘1张) 》另一本书是《Tomcat与Java Web开发技术详解(第2版)(附CD-ROM光盘1张)》，第一本书是出于业余爱好想研究下，第二本书是与本职工作有关。</p>
<p><a href="http://pic.jiucool.com/2009/7d9fc2da01bf_1289A/LAMPLinuxApacheMySQLPHP1.jpg"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="LAMP网站开发黄金组合Linux Apache MySQL PHP(附光盘1张)" border="0" alt="LAMP网站开发黄金组合Linux Apache MySQL PHP(附光盘1张)" src="http://pic.jiucool.com/2009/7d9fc2da01bf_1289A/LAMPLinuxApacheMySQLPHP1_thumb.jpg" width="364" height="512" /></a></p>
<p><a href="http://pic.jiucool.com/2009/7d9fc2da01bf_1289A/TomcatJavaWeb2CDROM1.jpg"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="Tomcat与Java Web开发技术详解(第2版)(附CD-ROM光盘1张)" border="0" alt="Tomcat与Java Web开发技术详解(第2版)(附CD-ROM光盘1张)" src="http://pic.jiucool.com/2009/7d9fc2da01bf_1289A/TomcatJavaWeb2CDROM1_thumb.jpg" width="368" height="514" /></a> </p>
<p>刚开始在网上选书时看书内容也没多少，拿到手后，吓了一跳，每本书都不止新华字典那么厚，书太大，太厚，出门就有点不方便携带！</p>
<p>关于内容方面第一本书我刚看了第一章，主要是讲的linux基础,这些东西非常简单,讲得内容不多,讲得也不够详细!《LAMP网站开发黄金组合:Linux+Apache+MySQL+PHP(附光盘1张) 》看了下这本书目录主要重点是放在讲解PHP章节!</p>
<p>《Tomcat与Java Web开发技术详解(第2版)(附CD-ROM光盘1张)》这本书可以当作一个手册 ,当有哪部分内容生疏的时候可以随时查阅!^_^ 如果对此两本书有兴趣的同志,可以自己去看看,一本书价格大概在70元左右!也还可以^_^</p>
<p>No related posts.</p><br/>
<a href="http://www.jiucool.com/godaddy-domain" target="_blank"><img src="http://pic.jiucool.com/2010/godaddy_score_savings_468x60.jpg" /></a>
<hr />
<p><small>© 久酷 for <a href="http://www.jiucool.com">久酷</a>, 2009. |
<a href="http://www.jiucool.com/two-books/" target="_blank">Permalink</a> |
<a href="http://www.jiucool.com/two-books/#comments">40 comments</a> |
Twitter:
<a href="http://twitter.com/jiucool" target="_blank">@jiucool</a>
<br/>
Post tags: <a href="http://www.jiucool.com/tag/lamp%e5%bc%80%e5%8f%91/" rel="tag">lamp开发</a>, <a href="http://www.jiucool.com/tag/web%e5%bc%80%e5%8f%91/" rel="tag">web开发</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://www.jiucool.com/two-books/feed/</wfw:commentRss>
		<slash:comments>40</slash:comments>
		</item>
		<item>
		<title>自己手动获取MyEclipse 注册码</title>
		<link>http://www.jiucool.com/manually-to-obtain-its-own-myeclipse-keygen-key/</link>
		<comments>http://www.jiucool.com/manually-to-obtain-its-own-myeclipse-keygen-key/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 14:17:10 +0000</pubDate>
		<dc:creator>久酷</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[应用相关]]></category>
		<category><![CDATA[myeclipse 7.1 注册码]]></category>

		<guid isPermaLink="false">http://www.jiucool.com/?p=6164</guid>
		<description><![CDATA[该方法来自互联网，现已无法考证原文出处。方法可行，不错，故分享下。我用jiucool 为name生成的序列号如下：name:jiucool&#160;&#160;&#160; Serial:wLR8ZC-855575-67515756496433201

1、建立java Project，随便取个名字就OK.

2、建立一个名字为MyEclipseGen的类文件，内容见附件。 

3、运行该代码，在控制台中会出现： please input register name: （你的name） 即生成序列号。

<span class="readmore"><a href="http://www.jiucool.com/manually-to-obtain-its-own-myeclipse-keygen-key/" title="自己手动获取MyEclipse 注册码">Read More: 2247 Words Totally</a></span>]]></description>
			<content:encoded><![CDATA[<p>该方法来自互联网，现已无法考证原文出处。方法可行，不错，故分享下。我用jiucool 为name生成的序列号如下：name:jiucool&#160;&#160;&#160; Serial:wLR8ZC-855575-67515756496433201</p>
<p>1、建立java Project，随便取个名字就OK.</p>
<p>2、建立一个名字为MyEclipseGen的类文件，内容见附件。 </p>
<p>3、运行该代码，在控制台中会出现： please input register name: （你的name） 即生成序列号。</p>
<p>4、进入myeclipse,输入name and serial,It’s OK.</p>
<pre>附件：

import <a href="http://www.jiucool.com/tag/java/" class="st_tag internal_tag" rel="tag" title="Posts tagged with java">java</a>.io.*;

public class MyEclipseGen {
private static final String LL = &quot;Decompiling this copyrighted software is a violation of both your license agreement and the Digital Millenium Copyright Act of 1998 (<a href="http://www.jiucool.com/tag/http/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Http">http</a>://www.loc.gov/copyright/legislation/dmca.pdf). Under section 1204 of the DMCA, penalties range up to a $500,000 fine or up to five years imprisonment for a first offense. Think about it; pay for a license, avoid prosecution, and feel better about yourself.&quot;;
public String getSerial(String userId, String licenseNum) {
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.add(1, 3);
cal.add(6, -1);
java.text.NumberFormat nf = new java.text.DecimalFormat(&quot;000&quot;);
licenseNum = nf.format(Integer.valueOf(licenseNum));
String verTime = new StringBuilder(&quot;-&quot;).append(new java.text.
SimpleDateFormat(&quot;yyMMdd&quot;).format(cal.getTime())).append(&quot;0&quot;).
toString();
String type = &quot;YE3MP-&quot;;
String need = new StringBuilder(userId.substring(0, 1)).append(type).
append(&quot;300&quot;).append(licenseNum).append(verTime).toString();
String dx = new StringBuilder(need).append(LL).append(userId).toString();
int suf = this.decode(dx);
String code = new StringBuilder(need).append(String.valueOf(suf)).
toString();
return this.change(code);
}

private int decode(String s) {
int i;
char[] ac;
int j;
int k;
i = 0;
ac = s.toCharArray();
j = 0;
k = ac.length;
while (j &lt; k) {
i = (31 * i) + ac[j];
j++;
}
return Math.abs(i);
}

private String change(String s) {
byte[] abyte0;
char[] ac;
int i;
int k;
int j;
abyte0 = s.getBytes();
ac = new char[s.length()];
i = 0;
k = abyte0.length;
while (i &lt; k) {
j = abyte0[i];
if ((j &gt;= 48) &amp;&amp; (j &lt;= 57)) {
j = (((j - 48) + 5) % 10) + 48;
} else if ((j &gt;= 65) &amp;&amp; (j &lt;= 90)) {
j = (((j - 65) + 13) % 26) + 65;
} else if ((j &gt;= 97) &amp;&amp; (j &lt;= 122)) {
j = (((j - 97) + 13) % 26) + 97;
}
ac[i] = (char) j;
i++;
}
return String.valueOf(ac);
}

public MyEclipseGen() {
super();
}

public static void main(String[] args) {
try {
System.out.println(&quot;please input register name:&quot;);
<a href="http://www.jiucool.com/tag/bufferedreader/" class="st_tag internal_tag" rel="tag" title="Posts tagged with BufferedReader">BufferedReader</a> reader = new <a href="http://www.jiucool.com/tag/bufferedreader/" class="st_tag internal_tag" rel="tag" title="Posts tagged with BufferedReader">BufferedReader</a>(new InputStreamReader(
System.in));
String userId = null;
userId = reader.readLine();
MyEclipseGen myeclipsegen = new MyEclipseGen();
String res = myeclipsegen.getSerial(userId, &quot;20&quot;);
System.out.println(&quot;Serial:&quot; + res);
reader.readLine();
} catch (IOException ex) {
}
}
} </pre>
<p>No related posts.</p><br/>
<a href="http://www.jiucool.com/godaddy-domain" target="_blank"><img src="http://pic.jiucool.com/2010/godaddy_score_savings_468x60.jpg" /></a>
<hr />
<p><small>© 久酷 for <a href="http://www.jiucool.com">久酷</a>, 2009. |
<a href="http://www.jiucool.com/manually-to-obtain-its-own-myeclipse-keygen-key/" target="_blank">Permalink</a> |
<a href="http://www.jiucool.com/manually-to-obtain-its-own-myeclipse-keygen-key/#comments">6 comments</a> |
Twitter:
<a href="http://twitter.com/jiucool" target="_blank">@jiucool</a>
<br/>
Post tags: <a href="http://www.jiucool.com/tag/myeclipse-71-%e6%b3%a8%e5%86%8c%e7%a0%81/" rel="tag">myeclipse 7.1 注册码</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://www.jiucool.com/manually-to-obtain-its-own-myeclipse-keygen-key/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Thinking in java免费下载学习</title>
		<link>http://www.jiucool.com/thinking-in-java-mian-fei-xia-zai-xue-xi/</link>
		<comments>http://www.jiucool.com/thinking-in-java-mian-fei-xia-zai-xue-xi/#comments</comments>
		<pubDate>Sun, 14 Sep 2008 01:25:13 +0000</pubDate>
		<dc:creator>久酷</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[其他文章]]></category>

		<guid isPermaLink="false">http://www.jiucool.com/?p=1620</guid>
		<description><![CDATA[［获奖历史］

·2003年《Software  Development》杂志最佳书籍Jolt大奖

 ·2003年《Java Developer’s  Journal》读者选择最佳书籍奖

 ·2001年《Java World》编辑选择最佳书籍奖

 ·2000年《Java  World》读者选择最佳书籍奖

 ·1999年《Software Development》杂志最佳产品奖

<span class="readmore"><a href="http://www.jiucool.com/thinking-in-java-mian-fei-xia-zai-xue-xi/" title="Thinking in java免费下载学习">Read More: 566 Words Totally</a></span>]]></description>
			<content:encoded><![CDATA[<p><strong><span style="color: #990000;">［获奖历史］</span></strong></p>
<p>·2003年《Software  Development》杂志最佳书籍Jolt大奖<br />
 ·2003年《<a href="http://www.jiucool.com/tag/java/" class="st_tag internal_tag" rel="tag" title="Posts tagged with java">Java</a> Developer’s  Journal》读者选择最佳书籍奖<br />
 ·2001年《Java World》编辑选择最佳书籍奖<br />
 ·2000年《Java  World》读者选择最佳书籍奖<br />
 ·1999年《Software Development》杂志最佳产品奖<br />
 ·1998年《Java  Developer’s Journal》编辑选择最佳书籍奖</p>
<p>从本书获得的各项大奖以及来自世界各地的读者评论中，不难看出这是一本经典之作。本书的作者拥有多年教学经验，对c、c++以及Java语言都有独到、深入的见解，以通俗易懂及小而直接的示例解释了一个个晦涩抽象的概念。本书共22章，包括操作符、控制执行流程、访问权限控制、复用类、多态、接口、通过异常处理错误、字符串、泛型、数组、容器深入研究、Iava’UO系统、枚举类型、并发以及图形化用户界面等内容。这些丰富的内容，包含了Java语言基础语法以及高级特性，适合各个层次的Java程序员阅读，同时也是高等院校讲授面向对象程序设计语言以及Java语言的绝佳教材和参考书。</p>
<p>看了下这本书真贵啊，买不起啊。</p>
<p><img style="border: 1px solid black;" src="http://i3.6.cn/cvbnm/0d/81/d3/90fb4b34b6c65b38dd4832650ce26805.jpg" alt="" width="451" height="279" /></p>
<p><span style="font-size: large; color: #ff0000;">下载地址：<a href="http://jiucool.googlecode.com/files/think%20in%20java.rar" target="_blank">http://jiucool.googlecode.com/files/think%20in%20java.rar</a></span></p>
<p>No related posts.</p><br/>
<a href="http://www.jiucool.com/godaddy-domain" target="_blank"><img src="http://pic.jiucool.com/2010/godaddy_score_savings_468x60.jpg" /></a>
<hr />
<p><small>© 久酷 for <a href="http://www.jiucool.com">久酷</a>, 2008. |
<a href="http://www.jiucool.com/thinking-in-java-mian-fei-xia-zai-xue-xi/" target="_blank">Permalink</a> |
<a href="http://www.jiucool.com/thinking-in-java-mian-fei-xia-zai-xue-xi/#comments">2 comments</a> |
Twitter:
<a href="http://twitter.com/jiucool" target="_blank">@jiucool</a>
<br/>
Post tags: <br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://www.jiucool.com/thinking-in-java-mian-fei-xia-zai-xue-xi/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>关于jdk和jre</title>
		<link>http://www.jiucool.com/guan-yu-jdk-he-jre/</link>
		<comments>http://www.jiucool.com/guan-yu-jdk-he-jre/#comments</comments>
		<pubDate>Sun, 07 Sep 2008 00:02:37 +0000</pubDate>
		<dc:creator>久酷</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[其他文章]]></category>
		<category><![CDATA[jdk]]></category>
		<category><![CDATA[jre]]></category>

		<guid isPermaLink="false">http://www.jiucool.com/?p=1514</guid>
		<description><![CDATA[刚刚学java，应该搞懂一些基本问题！

大家肯定在安装JDK的时候会有选择是否安装单独的jre，一般都会一起安装，我也建议大家这样做。因为这样更能帮助大家弄清楚它们的区别：

Jre   是java   runtime   environment，   是java程序的运行环境。既然是运行，当然要包含jvm，也就是大家熟悉的虚拟机啦，   还有所有java类库的class文件，都在lib目录下打包成了jar.大家可以自己验证。至于在windows上的虚拟机是哪个文件呢？   学过MFC的都知道什么是dll文件吧，那么大家看看jre/bin/client里面是不是有一个jvm.dll呢？那就是虚拟机。

<span class="readmore"><a href="http://www.jiucool.com/guan-yu-jdk-he-jre/" title="关于jdk和jre">Read More: 1248 Words Totally</a></span>]]></description>
			<content:encoded><![CDATA[<p>刚刚学java，应该搞懂一些基本问题！</p>
<p>大家肯定在安装JDK的时候会有选择是否安装单独的jre，一般都会一起安装，我也建议大家这样做。因为这样更能帮助大家弄清楚它们的区别：</p>
<p><a href="http://www.jiucool.com/tag/jre/" class="st_tag internal_tag" rel="tag" title="Posts tagged with jre">Jre</a>   是java   runtime   environment，   是java程序的运行环境。既然是运行，当然要包含jvm，也就是大家熟悉的虚拟机啦，   还有所有java类库的class文件，都在lib目录下打包成了jar.大家可以自己验证。至于在windows上的虚拟机是哪个文件呢？   学过MFC的都知道什么是dll文件吧，那么大家看看jre/bin/client里面是不是有一个jvm.dll呢？那就是虚拟机。</p>
<p><a href="http://www.jiucool.com/tag/jdk/" class="st_tag internal_tag" rel="tag" title="Posts tagged with jdk">Jdk</a>   是java   development   kit，是java的开发工具包，里面包含了各种类库和工具。当然也包括了另外一个Jre.     那么为什么要包括另外一个Jre呢？而且jdk/jre/bin同时有client和server两个文件夹下都包含一个jvm.dll.   说明是有两个虚拟机的。这一点不知道大家是否注意到了呢？</p>
<p>相信大家都知道jdk的bin下有各种java程序需要用到的命令，与jre的bin目录最明显的区别就是jdk下才有javac，这一点很好理解，因为 jre只是一个运行环境而已。与开发无关，正因为如此，具备开发功能的jdk自己的jre下才会同时有client性质的jvm和server性质的 jvm，   而仅仅作为运行环境的jre下只需要client性质的jvm.dll就够了。</p>
<p>记得在环境变量path中设置jdk/bin路径麽？这应该是大家学习Java的第一步吧，   老师会告诉大家不设置的话javac和java是用不了的。确实jdk/bin目录下包含了所有的命令。可是有没有人想过我们用的java命令并不是 jdk/bin目录下的而是jre/bin目录下的呢？不信可以做一个实验，大家可以把jdk/bin目录下的java.exe剪切到别的地方再运行 java程序，发现了什么？一切OK！</p>
<p>那么有人会问了？我明明没有设置jre/bin目录到环境变量中啊？</p>
<p>试想一下如果java为了提供给大多数人使用，他们是不需要jdk做开发的，只需要jre能让java程序跑起来就可以了，那么每个客户还需要手动去设置 环境变量多麻烦啊？所以安装jre的时候安装程序自动帮你把jre的java.exe添加到了系统变量中，验证的方法很简单，大家看到了系统环境变量的 path最前面有“%SystemRoot%\system32；%SystemRoot%；”这样的配置，那么再去<span class="channel_keylink">Windows</span>/system32下面去看看吧，发现了什么？有一个java.exe.</p>
<p>如果强行能够把jdk/bin挪到system32变量前面，当然也可以迫使使用jdk/jre里面的java，不过除非有必要，我不建议大家这么做。使用单独的jre跑java程序也算是客户环境下的一种<span class="channel_keylink">测试</span>。</p>
<p>这下大家应该更清楚jdk和jre内部的一些联系和区别了吧？</p>
<p>No related posts.</p><br/>
<a href="http://www.jiucool.com/godaddy-domain" target="_blank"><img src="http://pic.jiucool.com/2010/godaddy_score_savings_468x60.jpg" /></a>
<hr />
<p><small>© 久酷 for <a href="http://www.jiucool.com">久酷</a>, 2008. |
<a href="http://www.jiucool.com/guan-yu-jdk-he-jre/" target="_blank">Permalink</a> |
<a href="http://www.jiucool.com/guan-yu-jdk-he-jre/#comments">3 comments</a> |
Twitter:
<a href="http://twitter.com/jiucool" target="_blank">@jiucool</a>
<br/>
Post tags: <a href="http://www.jiucool.com/tag/jdk/" rel="tag">jdk</a>, <a href="http://www.jiucool.com/tag/jre/" rel="tag">jre</a><br/>
</small></p>]]></content:encoded>
			<wfw:commentRss>http://www.jiucool.com/guan-yu-jdk-he-jre/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

