I use a code that imports the following package:
Exception in thread "main" java.lang.Error: Unresolved compilation
problems: HttpClient cannot be resolved to a type
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
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.