title: How to bring in a Apache HttpClient Lookup loader?
body: <p>I have trouble running the Quick Start example from Apache HttpComponents:</p>
  
  <ul>
  <li><a href="http://hc.apache.org/httpcomponents-client-ga/quickstart.html" rel="nofollow noreferrer">HttpClient Quick Start</a></li>
  </ul>
  
  <p>Initially I was using it as a guide.  When that failed, I downloaded the example Java file and still with no luck.  I believe there's some missing information on the page.  After all a quick-start should run, and get you started.</p>
  
  <p>I think this is like the problem described here.</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/19641910/failing-to-create-new-poolinghttpclientconnectionmanager">Failing to create new PoolingHttpClientConnectionManager</a>
  
  <ul>
  <li>use: <strong>HttpClient httpclient = HttpClientBuilder.create().build();</strong></li>
  </ul></li>
  </ul>
  
  <p>I believe the answer is in this question (also indicated by the comment below).  I've tested the suggested answer, and it works for me!</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/15336477/java-httpclient-how-hard-can-it-be">Deprecated Java HttpClient - How hard can it be?</a></li>
  </ul>
  
  <p>The Quick Start example code fails on the first line basically.  I split it up to check things step by step.</p>
  
  <pre><code>public class QuickStart {
  
      public static void quickStart() throws IOException { // String[] args) throws Exception {
  
          CloseableHttpClient httpclient;
          httpclient = HttpClients.createDefault();
  
          try {
              HttpGet httpGet;
                  :
  </code></pre>
  
  <p>This line throws an error:</p>
  
  <ul>
  <li>httpclient = HttpClients.createDefault();</li>
  <li>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/config/<strong>Lookup</strong></li>
  </ul>
  
  <p>I appreciate the comment that the look-up class may be in the HttpCore module.  However the quick start and other beginner tutorials do not explain HOW to bring in the Core component into my example project?  There's is no mention of HttpCore or Lookup -- I did a string find on the page.</p>
  
  <p>There are a couple of questions really. </p>
  
  <ol>
  <li>What is needed to fix the Quick Start example for it to run as written?
  
  <ul>
  <li>An implication here is that the Quick Start page is broken because the example does not  start, quick or otherwise.</li>
  </ul></li>
  <li>How does one "<em>induce</em>" the HttpCore to integrate with a simple one Java file program illustrated by the <a href="http://hc.apache.org/httpcomponents-client-ga/quickstart.html" rel="nofollow noreferrer">HttpClient Quick Start</a>?</li>
  <li>Is there or was there some intention for the HttpCore to be brought in optionally?  
  
  <ul>
  <li>I looked in the POM file, the HttpClient has-a dependency on HttpCore for the build.</li>
  <li>Do I need to add something here to bring the HttpCore along into the JAR or something?</li>
  </ul></li>
  <li>Is there a better way to use the HttpClient to make a small Java program similar to the Quick Start?</li>
  <li>More in the spirit of improving the web: <em>Please TEST examples and Quick Starts before posting them</em>...  
  
  <ul>
  <li>This happens more often than folk would believe.  Generally there's small things which I just fix.  I think it would be better if we can post stuff that runs. </li>
  </ul></li>
  </ol>
  
  <p>Concerning this issue.  The call: HttpClients.<strong>createDefault</strong>(), should be expected to work based on the quick start code, otherwise the name "<em>createDefault</em>" appears to be an error. <em>Many advance thanks ...</em></p>
  
  <p><strong><em>update</em></strong>:</p>
  
  <p>I thought I should show what Netbeans put in the POM for the HttpComponents ...</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
          &lt;artifactId&gt;httpclient&lt;/artifactId&gt;
          &lt;version&gt;4.3.4&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
          &lt;artifactId&gt;httpcore&lt;/artifactId&gt;
          &lt;version&gt;4.3.2&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>I've looked at some other examples. These also just call defaultClient().  So it seems like a bit more of a mystery than just there being a problem in the quick-start example.  Other examples:</p>
  
  <ul>
  <li><a href="http://www.javacodegeeks.com/2012/09/simple-rest-client-in-java.html" rel="nofollow noreferrer">Simple REST client in Java</a></li>
  <li><a href="http://hc.apache.org/httpcomponents-client-ga/examples.html" rel="nofollow noreferrer">HttpClient Examples</a></li>
  <li><a href="http://www.vogella.com/tutorials/ApacheHttpClient/article.html" rel="nofollow noreferrer">ApacheClient tutorial</a></li>
  </ul>
  
  <p>Still no explicit mention for Lookup or linking with HttpCore.  Should these examples work?  If so what 'extra' is needed in a (Netbeans) Maven build to make it happen?</p>