title: How to import "HttpClient" to Eclipse?
body: <p>How do I import "HttpClient" in Eclipse? I downloaded HttpClient from <a href="http://hc.apache.org/downloads.cgi" rel="noreferrer">http://hc.apache.org/downloads.cgi</a> just now. I added it to my Eclipse new java project and want to run a example copy from website.</p>
  
  <p>This example uses <code>import org.apache.commons.httpclient.*;</code> But, what pity is, it shows that Eclipse can't resolve this.</p>
  
  <p>Now, I want to know the right way to import new released HttpClient to my project.
  Is it necessary to add some jar to classpath? What is it?</p>
  
  <p>This is the whole example I run. I guess new released "HTTPClient" changed its import jar, is it true?</p>
  
  <pre><code>package http.demo; 
  import java.io.IOException; 
  import org.apache.commons.httpclient.*; 
  import org.apache.commons.httpclient.methods.*;
  
  public class SimpleHttpClient { 
     public static void main(String[] args) throws IOException {
        HttpClient client = new HttpClient();
        client.getHostConfiguration().setHost( "www.imobile.com.cn" , 80, "http" );
        method = getPostMethod();    
        client.executeMethod(method);  
        System.out.println(method.getStatusLine());   
        Stringresponse=newString(method.getResponseBodyAsString().getBytes("8859_1"));
  
        System.out.println(response);
        method.releaseConnection();
     }
  
  
     private static HttpMethod getGetMethod(){
        return new GetMethod("/simcard.php?simcard=1330227");
     }
  
      private static HttpMethod getPostMethod(){
        PostMethod post = new PostMethod( "/simcard.php" );
        NameValuePair simcard = new NameValuePair( "simcard" , "1330227" );
        post.setRequestBody( new NameValuePair[] { simcard});
        return post; 
     } 
  }
  </code></pre>