繁体   English   中英

org.apache包无法在Eclipse中解析

[英]org.apache packages can't be resolved in Eclipse

下列

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。 我收到了错误的包裹吗?

我相信这是链接:

阿帕奇

听起来不错:

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.

将罐子拖入我的项目后,我遇到了同样的问题。

右键单击jar并选择Build-path -> Add-to-Build-Path为我工作。

如果您首先将这些JAR添加到Android项目中,但现在想要在另一个(非Android)项目中使用它们,请确保已将JAR导入到此其他项目中。 在Eclipse中,每个项目都维护自己的构建类路径设置,因此将JAR导入到一个项目中并不会自动使它们可用于其他项目。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM