In this chapter, we will explain how to set an environment for HttpClient in Eclipse IDE. Before proceeding with the installation, make sure that you already have Eclipse installed in your system. If not, download and install Eclipse.

For more information on Eclipse, please refer to our Eclipse Tutorial.

Step 1 - Download the dependency JAR file

Open the official homepage of the HttpClient (components) website and go to the download page

httpcomponents_downloads.jpg

Then, download the latest stable version of HttpClient. Here, throughout the tutorial, we are using the version 4.5.6 hence download the file 4.5.6.zip.

Within the downloaded folder, you will find a folder named lib and this contains the required Jar files that are to be added in the classpath of your project, to work with HttpClient.

Step 2 - Create a project and set build path

Open eclipse and create a sample project. Right click on the project select the option Build Path → Configure Build Path as shown below.

build_path.jpg

In the Java Build Path frame in the Libraries tab, click on Add External JARs.

add_external_jars.jpg

And select all the jar files in the lib folder and, click on Apply and Close.

jar_files.jpg

You are all set to work with HttpClient library in eclipse.