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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 09:45:40  来源:igfitidea点击:

Error HttpClient cannot be resolved to a type

javaapachehttpyql

提问by Mubashir Ali Memon

here is the snapshot of the code

这是代码的快照

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.jarbut 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 HttpClientis in package org.apache.http.client. The new version of GetMethodis HttpGet.

HttpClient是包org.apache.http.client。的新版本GetMethodHttpGet.

It's all here.

这一切都在这里

回答by coolDude

You can download jar file from below link and import in your project

您可以从下面的链接下载 jar 文件并导入到您的项目中

Download jar File

下载jar文件