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
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.
In theĀ Java Build PathĀ frame in theĀ LibrariesĀ tab, click onĀ Add External JARs.
And select all the jar files in the lib folder and, click onĀ Apply and Close.
You are all set to work with HttpClient library in eclipse.