title: java and httpclient java.lang.NoClassDefFoundError
body: <p>I have problem.</p>
  
  <pre><code>import java.io.File;
  import java.io.IOException;
  import java.io.UnsupportedEncodingException;
  import org.apache.http.client.ClientProtocolException;
  import org.apache.http.client.HttpClient;
  import org.apache.http.client.ResponseHandler;
  import org.apache.http.client.methods.HttpPost;
  import org.apache.http.entity.mime.MultipartEntity;
  import org.apache.http.entity.mime.content.FileBody;
  import org.apache.http.entity.mime.content.StringBody;
  import org.apache.http.impl.client.BasicResponseHandler;
  import org.apache.http.impl.client.DefaultHttpClient;
  
  public class qq {
  
          public static void main(String[] args) throws UnsupportedEncodingException, IOException {
          HttpClient httpclient = new DefaultHttpClient();
  //        HttpPost httppost = new HttpPost("http://192.168.0.102/uploadtest/upload_photo");
          System.out.println("aaaa");
  
      }
  }
  </code></pre>
  
  <p>File manifest.mf:</p>
  
  <pre>
  Manifest-version: 1.0
  Main-Class: qq
  </pre>
  
  <p>OS debian 8
  java version:
  java version "1.8.0_111"
  Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
  Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)</p>
  
  <p>And:</p>
  
  <pre>
  javac -cp ./lib/httpclient-4.2.5.jar:./lib/httpcore-4.4.5.jar:./lib/httpmime-4.2.5.jar:./lib/commons-logging-1.2.jar qq.java
  jar cfm test.jar manifest.mf qq.class
  </pre>
  
  <p>Its ok, no error, exit code - 0.</p>
  
  <p>I try:</p>
  
  <pre>
  # java -jar test.jar
  Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/impl/client/DefaultHttpClient
          at qq.main(qq.java:18)
  Caused by: java.lang.ClassNotFoundException: org.apache.http.impl.client.DefaultHttpClient
          at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
          at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
          ... 1 more
  
  </pre>
  
  <p>How to fix this ?</p>