java MultiPartEntityBuilder 无法解析为类型
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26910712/
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
MultiPartEntityBuilder cannot be resolved to a type
提问by mark
I used a newer class to substitute a deprecated one. The class is MultiPartEntityBuilder. When i wrote it in the code, the compiler suggested me to import the following package
我使用了一个较新的类来代替一个已弃用的类。该类是 MultiPartEntityBuilder。我在代码中写的时候,编译器建议我导入如下包
import org.apache.http.entity.mime.MultipartEntityBuilder;
I have imported it. But the compiler cannot still find it, giving me the error on the title
我已经导入了。但是编译器仍然找不到它,给我标题错误
MultiPartEntityBuilder cannot be resolved to a type
So, it sounds quite strange to me. I've already succesfully imported similar packages
所以,这对我来说听起来很奇怪。我已经成功导入了类似的包
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.ContentBody;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.entity.mime.content.StringBody;
Does it mean i have an old version which doesn't define any class named MultiPartEntityBuilder ? How does the compiler know that i should import that class, part of that package, if he got an old version of that package?
这是否意味着我有一个旧版本,它没有定义任何名为 MultiPartEntityBuilder 的类?如果编译器有一个旧版本的包,编译器怎么知道我应该导入那个类,那个包的一部分?
Please note that
请注意
import org.apache.http.entity.mime.MultipartEntityBuilder;
is market as an error.
是市场错误。
回答by Rohit Dubey
Upload Apache HttpClient Mime 4.3.1 jar file http://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime/4.3.1
上传 Apache HttpClient Mime 4.3.1 jar 文件http://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime/4.3.1
回答by Maksym
It means that org.apache.http.entity.mime.MultipartEntityBuilder isn't accessible during compilation time. You should add it to your project somehow depends on your build tool.
这意味着在编译期间无法访问 org.apache.http.entity.mime.MultipartEntityBuilder。您应该将它添加到您的项目中,这取决于您的构建工具。
回答by Nicholas Hansen
Looks like a spelling error, you had MultiPartEntityBuilder instead of MultipartEntityBuilder. The "P" shouldn't be capitalised.
看起来像是拼写错误,您使用的是 MultiPartEntityBuilder 而不是 MultipartEntityBuilder。“P”不应该大写。