java 缺少 HttpClient 的依赖项

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6341161/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 15:28:39  来源:igfitidea点击:

Missing dependency for HttpClient

javahttpclient

提问by Stijn.V

I'm using a HttpClient in a Java desktop application. I've added httpclient-4.0.1.jarand httpmime-4.0.1.jarto the build path, but I receive the error 'The type org.apache.http.HttpResponse cannot be resolved. It is indirectly referenced from required .class files'. Does anyone know which dependency/jar I'm missing?

我在 Java 桌面应用程序中使用 HttpClient。我已将httpclient-4.0.1.jarhttpmime-4.0.1.jar 添加到构建路径,但收到错误“无法解析类型 org.apache.http.HttpResponse”。它是从所需的 .class 文件间接引用的。有谁知道我缺少哪个依赖项/jar?

回答by sudmong

Probably you are missing httpcore jar.

可能您缺少 httpcore jar。

回答by Michael

That class is part of the HttpCore library, here's a link showing it's uses:

该类是 HttpCore 库的一部分,这是一个显示其用途的链接:

http://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/class-use/HttpResponse.html

http://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/class-use/HttpResponse.html

You'll need to include the jar in your classpath / lib.

您需要在类路径/lib 中包含该 jar。

回答by planetjones

I think you'll also need:

我想你还需要:

httpcore-4.x.x.jar