title: ClassNotFoundException when executing a .jar, but not when executing with classpath
body: <p><br><br>
  I have this code in Java that I'm to compile and execute. The code itself is working and the compilation goes ok. When I execute the code giving the classpath, with a command like "java -cp classes:lib/* main.class parameters" it works well. 
  <br>
  But the problem is when I try to generate a jarfile and execute it with a command like "java -jar file.jar parameters". When I execute this, code starts running but crashes on the following error:
  <br><br></p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/ssl/TrustStrategy&lt;br&gt;
  at java.lang.ClassLoader.defineClass1(Native Method)&lt;br&gt;
  at java.lang.ClassLoader.defineClass(ClassLoader.java:634)&lt;br&gt;
  at [...]
  Caused by: java.lang.ClassNotFoundException: org.apache.http.ssl.TrustStrategy&lt;br&gt;
  at [...]
  ... 17 more
  </code></pre>
  
  <p><br>
  I thought it could be missing some class on MANIFEST, though for what I could find on the internet, the package providing this class is <strong>httpcore</strong>, which is included there. I tried to modify in many ways the manifest with no success, so I don't believe the problem is on this file.
  <br>
  I don't know if it helps, but the code is being compiled with <strong>ant</strong> and I have some 3rd-party libs stored on a <strong>lib</strong> folder, which is on the classpath of MANIFEST. <br>
  I'm compiling on a computer with: </p>
  
  <pre><code>openjdk version "1.8.0_131"
  OpenJDK Runtime Environment (build 1.8.0_131-b12)
  OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)
  </code></pre>
  
  <p>And running it on a computer with:<br><br></p>
  
  <pre><code>java version "1.6.0_24"
  OpenJDK Runtime Environment (IcedTea6 1.11.3) (6b24-1.11.3-1ubuntu0.12.04.1)
  OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
  </code></pre>
  
  <p><br><br>
  Does anyone know why may this be happening?</p>