I keep getting the error:
"The import org.apache.commons.httpclient cannot be resolved"
and don't know how to resolve it. Help would be much appreciated, as I am clearly missing something stupid.
Here is what I have done so far:
-- Downloaded the httpcomponents-client-4.0-bin-with-dependencies from Jakarta / Apache, extracted it and put the JAR's into /jre/lib/ext
... So it should find it, right? (It is accessing the correct JRE, as found in Eclipse->Preferences->Java ... )
-- Added them to the build path (Properties -> Build path -> Add external Jars)
-- Followed advice on this page: http://blog.sherifmansour.com/?p=207,
.... including Clean, removing and re-adding them, F5 to refresh. When I remove then, Eclipse changes the length of the wiggly red line under them, so it is clearly finding something.
But I keep getting the "cannot be resolved" error for these imports:
Any help would be GREATLY appreciated, as the next step is to beat my head with a stick.
I don't know, but don't think an internal conflict is the problem: I have tried it on a friend's machine, and it works fine, so it must be a setting within my configuration. A quick google suggests that the httpclient I'm trying to use, http://hc.apache.org/httpclient-3.x/, is not conflicting. I wonder if it is possible that it is somehow being included twice?
The type HttpClient is not accessible due to restriction on required library C:\Program Files\Java\jdk1.6.0_02\jre\lib\ext\httpclient-4.0.jar
Whose idea was it to put that jar into the extensions directory? That's usually a quick and dirty way to get things going for people who don't know how to set their classpath, and it often isn't a good idea for various reasons. This appears to be one of those times. Get it out of there.
Thanks Paul - moving them out helped. I removed them to a different directory, and then readded them using "add external JARS", and the errors disappear with the includes. It now it tells me:
Cannot instantiate the type HttpClient
in line 12 above (The "new HttpClient();" statement.)