Jury A Jury A - 1 year ago 137
Java Question

import org.apache.commons.httpclient.*

I use a code that imports the following package:

import org.apache.commons.httpclient.*;

I use eclipse. I went to http://hc.apache.org/downloads.cgi & I downloaded the Jar files, I added them to my project. Still eclipse making an error for this.

Exception in thread "main" java.lang.Error: Unresolved compilation
problems: HttpClient cannot be resolved to a type

What is the problem?

Answer Source

If you are using the latest (4.x) version of these modules, they have been refactored a lot. For example, the package name is now org.apache.http.client. Old sample code will have to be modified. Look at the Javadocs and the Quickstart for the new project.

The (discouraged) alternative would be to get the old (3.x) version.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download