以下
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
无法解决。我下载了Apache Http软件包并通过外部jar选项导入它们,但它仍然无法解决。在Android中它似乎可以工作,在SDK中猜测它,但在这里我不是在做Android。我收到了错误的包裹吗?
我相信这是链接:
答案 0 :(得分:13)
听起来确定:
1) The .jar file in question should be something like "httpcore-4.0.1.jar".
Please confirm the name.
2) Adding this to "External Libraries" is absolutely the correct thing to do.
3) For compiling in the Eclipse IDE, you must:
a) Select your project
b) Select "Build Path" > "Add External Libraries"
4) For running in the Eclipse IDE, you must
a) Select "Run" > "Run configurations".
Choose your (Java Application?) configuration.
b) Select "Classpath" > "Add External Jar"
5) For running outside of the Eclipse IDE, you must make sure the .jar
file is present and your -cp (Classpath) argument is set correctly.
答案 1 :(得分:1)
将罐子拖入我的项目后,我遇到了同样的问题。
右键单击jar并选择Build-path -> Add-to-Build-Path
为我工作。
答案 2 :(得分:0)
如果您首先将这些JAR添加到Android项目中,但现在想要在另一个(非Android)项目中使用它们,请确保已将JAR导入到此其他项目中。在Eclipse中,每个项目都维护自己的构建类路径设置,因此将JAR导入到一个项目中并不会自动使它们可用于其他项目。