I have added the .jars to my library and I can also instantiate other classes in the JAR. What gives? I've tried to clean the project etc.
It's a compiler-time error. Eclipse won't let me instantiate it.
I'm importing the correct library, not the sun version, and using the default contructor, specified by their tutorial
HttpClient client = new HttpClient();
(Eclipse, mac, Apache HTTP, "HttpClient 4.0.1 (GA)" downloaded from here)
HttpClient
is an interface in 4.x, use DefaultHttpClient
for instances.
HttpClient httpclient = new DefaultHttpClient();
If you are using 4.3, one way to initialize it is:
CloseableHttpClient httpclient = HttpClients.createDefault();
The quick start guide for 4.3 is located at:
http://hc.apache.org/httpcomponents-client-4.3.x/quickstart.html
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