How to import "org.apache.http.client.HttpClient" into Eclipse?

I tried httpcore.jar following the step here , but when I write import org.apache.http.client.HttpClient , it still cannot be found. The banner is already loaded by Maven.

Is httpcore the lib right to import org.apache.http.client.HttpClient ? or org.apache.http.client.HttpClient used only for Android development?

Another question: what is the difference between org.apache.http.client.HttpClient and org.apache.commons.httpclient.HttpClient ?

+6
source share
1 answer

First of all: http://hc.apache.org/httpclient-3.x/

The Commons HttpClient project is now complete, and it no longer works. It has been replaced by the Apache HttpComponents project in its HttpClient and HttpCore modules, which offer performance and greater flexibility.

So you need to use HttpClient (http://hc.apache.org/httpcomponents-client-ga/index.html), not Commons HttpClient (look at the name of the packages you said).

Yes, org.apache.http.client.HttpClient is the correct package.

Are you sure Maven got the .jar and it is on your way to the class?

+3
source

Source: https://habr.com/ru/post/921606/


All Articles