Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » using HttpClient 4.3.6 from apache.org
using HttpClient 4.3.6 from apache.org [message #1558194] Sun, 11 January 2015 10:07 Go to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 2
Registered: November 2011
Junior Member
Hi

I am running Luna Service Release 1 (4.4.1)
Build id: 20140925-1800
under window 7 pro.

I need to use HttpClient 4.3.6 which I found on the Apache Software Foundation web site.
Do I need to download the Binary or the Source?
How do I set it up so that I can use this library for any future projects?

many thanks
Re: using HttpClient 4.3.6 from apache.org [message #1558555 is a reply to message #1558194] Sun, 11 January 2015 14:57 Go to previous message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 01/11/2015 03:07 AM, Missing name Mising name wrote:
> Hi
>
> I am running Luna Service Release 1 (4.4.1)
> Build id: 20140925-1800
> under window 7 pro.
>
> I need to use HttpClient 4.3.6 which I found on the Apache Software
> Foundation web site.
> Do I need to download the Binary or the Source?
> How do I set it up so that I can use this library for any future projects?
>
> many thanks

I'm assuming you're a wee bit new to Eclipse? You need to get the JARs
from Apache (https://hc.apache.org/downloads.cgi). How this is done
depends on how you build.

Method 1, the hard way. If new, you should at least do this once so you
sort of understand how JARs work directly in the project.
- You're not using Maven or Ivy
- You download either the binary or the source

Disadvantages
- Not "green": you duplicate the JAR in all your projects.
- Complicated to manage: Build Path gets tiresome after a while.

Advantages
- It's complete transparent how the JARs relate to your project.

Unless you want to look at the source code or think Apache's got a bug
you'll have to trace through, download the binary.

- Create a subdirectory, lib, in your project.
- Use Build Path -> Libraries -> Add JARs to add:
httpclient-4.3.6.jar
httpclient-cache-4.3.6.jar
httpcore-4.3.3.jar
httpmime-4.3.6.jar
- You'll also need:
commons-codec-1.6.jar
commons-logging-1.1.3.jar
fluent-hc-4.3.6.jar

As soon as you do the Build Path step, this will make Apache HTTP
interface available to Eclipse Content Assist and you can use the errors
flagged by Eclipse in your source code to get the imports added (Eclipse
will do this for you).

Method 2, the easy, modern way, use Maven, Ivy, Gradle, etc. I'll show
Maven. You must add Apache HTTP Components to the <dependencies> section
in your pom.xml file:

Go to
http://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient/4.3.6
and look at the XML to copy and paste under the Maven tab.

Disadvantages
- Maven, Ivy, etc. appear complicated and mysterious at first.
- You can't build unless you run Maven at least once with a
connection to the Internet--puts the JARs in your local repository.

Advantages
- Very "green"--you'll only have one copy of any given JAR no matter
how many projects consume it.
- Once understood, you'll not have to look high and low for JARs.
Apache JARs are very easy to find. Many third-party JARs are not. Maven
knows how to find them, but it's hard sometimes and always tedious to
find them yourself.

If you're not using Maven or Ivy, you should make a mental note to
learn. The curve's a little steep and confusing at first, but Maven, as
much as I may not like it personally, is the lingua franca in our
industry today.

I hope this helps.

One last thing on Apache HTTP: It's notoriously inconsistent between
major versions. If you view code written using an older version, you
often won't be able to use it because classes change in big,
incompatible ways.

Cheers
Previous Topic:New Script Project is not getting created.
Next Topic:How to run two clients with parallel processes in Eclipse?
Goto Forum:
  


Current Time: Tue Apr 23 10:39:22 GMT 2024

Powered by FUDForum. Page generated in 0.08511 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top