今天終於解開了我 importt org.apache.commons.httpclient 錯誤的問題...

明明已經下載了 HttpClient 的元件來安裝,但是卻一直鬼擋牆的無法正確的匯入下列元件

import org.apache.commons.httpclient.cookie.*;
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;
import org.apache.commons.httpclient.params.HttpMethodParams;
import org.apache.comm

經過這個網頁 運用Apache HttpClient實作Get與Post動作
之後,一時恍然大悟,柳暗花明,終於解開了這個謎...

原來是我在 http://hc.apache.org/downloads.cgi 網頁上...
一直下錯檔案,我一直在下 HttpClient 4.0.1 (GA) 這個的4.0.1的版本...
卻不知道是要下最下面的 Commons HttpClient 3.1 (legacy) 的 3.1 的版本...


在此稍作紀錄,以利以後查詢之用...Source : 3.1.zip

PIC_04.jpg

 

下載後,在 Eclipse 的 Project \ Properties\ Libraries 中

Add External JARs 中,加入 commons-httpclient-3.1.jar

commons-logging.jar  & commons-codec-1.1.1.jar

即可

IMG000.png

以下是由該網站借抄的筆記



下面將逐一介紹怎樣使用這些功能。首先,我們必須安裝好 HttpClient。

Step1:

HttpClient 可以在http://hc.apache.org/downloads.cgi下載

Step2:

HttpClient用到了logging,你可以從這個 http://commons.apache.org/downloads/download_logging.cgi

下載到 common-logging,從下載後的壓縮包中取出 commons-logging.jar 加到 CLASSPATH 中

Step3:

HttpClient用到了codec,你可以從這個地址http://commons.apache.org/downloads/download_codec.cgi

下載到最新的 common-codec,從下載後的壓縮包中取出 commons-codec-1.x.jar 加到 CLASSPATH 中


 

以下有關相依套件

http://hc.apache.org/httpclient-3.x/dependencies.html

Dependencies

The following is a list of dependencies for this project. These dependencies are required to compile and run the application:

 

Artifact ID Type Version Scope URL Comment
commons-codec jar 1.2
http://commons.apache.org/codec/
commons-logging jar 1.0.4
http://commons.apache.org/logging/
junit jar 3.8.1 test http://www.junit.org/ .
arrow
arrow
    全站熱搜

    羅伯特 發表在 痞客邦 留言(5) 人氣()