I have tried httpcore.jar
by following the step here, but when I write import org.apache.http.client.HttpClient
, it still can't be found.
The jar is already downloaded by Maven.
Is httpcore
the right lib for importing org.apache.http.client.HttpClient
?
or org.apache.http.client.HttpClient
is just used for Android developing?
Another question, what is the difference between org.apache.http.client.HttpClient
and org.apache.commons.httpclient.HttpClient
?
I had exactly the same issue with eclipse 2020-12. In Preferences->Git I changed " Http Client " to " Java built-in HTTP " and the issue is resolved.
HttpClient is a HTTP/1.1 compliant HTTP agent implementation based on HttpCore. It also provides reusable components for client-side authentication, HTTP state management, and HTTP connection management.
An HttpClient can be used to send requests and retrieve their responses. An HttpClient is created through a builder . The builder can be used to configure per-client state, like: the preferred protocol version ( HTTP/1.1 or HTTP/2 ), whether to follow redirects, a proxy, an authenticator, etc.
First of all: http://hc.apache.org/httpclient-3.x/
The Commons HttpClient project is now end of life, and is no longer being developed. It has been replaced by the Apache HttpComponents project in its HttpClient and HttpCore modules, which offer better performance and more flexibility.
So, you need to use HttpClient (http://hc.apache.org/httpcomponents-client-ga/index.html), not Commons HttpClient (take a look in the name of the packages that you said).
Yes, org.apache.http.client.HttpClient is the right package.
Did you have certain that Maven obtained the .jar and it is in your classpath?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With