How to import the Httpclient library?

Asked

Viewed 1,150 times

1

Where should I put the library HttpClient? In all tutorials it is possible to find only examples of codes, but no one really explains that after downloading, we should put where?

http://hc.apache.org/downloads.cgi

There are two types, one with files httpclient-4.3.6.jar and another with Java files, where I put the files to then import, example: org.apache.http.client.methods.HttpPost

  • 1

    What IDE are you using? If you are not using any, what do you do to (try) compile the application?

  • @Victor I’m using Eclipse

1 answer

1


You have to specify the libraries you are using in your classpath. However depending on the type of project you are developing, there are some "conventions".

For example, if you are creating a web java project with the eclipse, the location where you would have to place the Jars, would be at: WebContent/WEB-INF/lib.

If you are doing a free-style project, you can check how to import the library at this link: http://www.wikihow.com/Add-JARs-to-Project-Build-Paths-in-Eclipse-(Java)

If it’s a project with the Maven, you don’t need to download the JAR, just add the dependency on the pom.xml and so on.

  • Could you put an example in your answer? remembering that Oce [Edit] your questions/answers whenever you want

  • Thank you so much, the same day I asked that question, I ended up learning how to do that thing you mentioned.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.