Java 错误 HttpClient 无法解析为类型
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21631699/
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
Error HttpClient cannot be resolved to a type
提问by Mubashir Ali Memon
I am trying to use http request and response method but i am getting error that
我正在尝试使用 http 请求和响应方法,但出现错误
The import org.apache.commons cannot be resolved
导入 org.apache.commons 无法解析
i have included httpcore.jar, httpclient.jar, httpmime.jar
but yet i am getting error.
我已经包括httpcore.jar, httpclient.jar, httpmime.jar
但我收到错误。
采纳答案by Sotirios Delimanolis
You've imported versions 4.3+ of the libraries but are trying to use the old HTTP commons classes (version 3?), ie GetMethod
.
您已经导入了 4.3+ 版本的库,但正在尝试使用旧的 HTTP 公共类(版本 3?),即GetMethod
.
The HttpClient
is in package org.apache.http.client
. The new version of GetMethod
is HttpGet
.
该HttpClient
是包org.apache.http.client
。的新版本GetMethod
是HttpGet
.
It's all here.
这一切都在这里。
回答by coolDude
You can download jar file from below link and import in your project
您可以从下面的链接下载 jar 文件并导入到您的项目中