title: ClassLoad Failing. ClassNotFound Exception
body: <p>I am trying to load a class from a JAR file. The class is called BasicLineFormatter. Since I am stating the class using a shell script using java -cp command. The class BasicLineFormatter exists in two of my jars, one bring the com.ibm.jaxws.thinclient_8.5.0.jar and another is a third party jar. But i am trying to load it from one of the jars (the third party jar). So I added this code:</p>
  
  <pre><code>JarFile jarFile = new JarFile("Path to JAR");
  Enumeration&lt;JarEntry&gt; enumeration = jarFile.entries();
  
  URL[] urls = { new URL("jar:file:" + "Path to JAR" + "!/") };
  URLClassLoader cl = URLClassLoader.newInstance(urls);
  
  System.out.println("Stating to load");
  while (enumeration.hasMoreElements()) {
      JarEntry je = enumeration.nextElement();
      if(je.isDirectory() || !je.getName().endsWith(".class")){
          continue;
      }
      String className = je.getName().substring(0,je.getName().length()-6);
      if (className.contains("BasicLineFormatter")) {
          System.out.println("Class Name: " + className);
          className = className.replace('/', '.');
          Class c = cl.loadClass(className);
      }
  
  }
  </code></pre>
  
  <p>But after that i still get the error:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoSuchFieldError: org/apache/http/message/BasicLineFormatter.INSTANCE
  at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.&lt;init&gt;(DefaultHttpRequestWriterFactory.java:52)
  at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.&lt;init&gt;(DefaultHttpRequestWriterFactory.java:56)
  at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.&lt;clinit&gt;(DefaultHttpRequestWriterFactory.java:46)
  at java.lang.J9VMInternals.initializeImpl(Native Method)
  at java.lang.J9VMInternals.initialize(J9VMInternals.java:236)
  at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.&lt;init&gt;(ManagedHttpClientConnectionFactory.java:82)
  at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.&lt;init&gt;(ManagedHttpClientConnectionFactory.java:95)
  at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.&lt;init&gt;(ManagedHttpClientConnectionFactory.java:104)
  at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.&lt;clinit&gt;(ManagedHttpClientConnectionFactory.java:62)
  at java.lang.J9VMInternals.initializeImpl(Native Method)
  at java.lang.J9VMInternals.initialize(J9VMInternals.java:236)
  </code></pre>
  
  <p>Can you please tell me what is going on here, or what am I doing wrong.</p>