title: NoClassDefFoundError: HttpClient 4 (APACHE)
body: <p>I am using apache http commons 4.I have added both httpcore-4.0.1.jar and httpclient-4.0.1.jar in the classpath of netbeans. I am getting error:<br>
  <strong>java.lang.NoClassDefFoundError: org/apache/http/impl/client/DefaultHttpClient</strong></p>
  
  <p>My Code is as follows. Please help.</p>
  
  <pre><code>import org.apache.http.client.HttpClient;
  import org.apache.http.client.ResponseHandler;
  import org.apache.http.client.methods.HttpGet;
  import org.apache.http.impl.client.BasicResponseHandler;
  import org.apache.http.impl.client.DefaultHttpClient;
  
  public class HttpClientManager {
      public HttpClient httpclient;
      public HttpClientManager() {
          this.init();
      }
  
      public void init() {
          try {
              httpclient = new DefaultHttpClient();
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  
      public void getCourseList() {
          String url = "http://exnet.in.th/api.php?username=demoinst&amp;ha=2b62560&amp;type=instructor";
          HttpGet httpget = new HttpGet(url);
  
          ResponseHandler&lt;String&gt; responseHandler = new BasicResponseHandler();
          try {
              String responseBody = httpclient.execute(httpget, responseHandler);
              System.out.println(responseBody);
  
          } catch (Exception e) {
          }    
      }
  }
  </code></pre>