Eclipse的java代码出错:The import org.apache cannot be resolved
来源:互联网 发布:淘宝网店策划案怎么写 编辑:程序博客网 时间:2024/06/07 19:06
Eclipse中,折腾java代码。
把之前在android中的代码拿过来使用。
结果出现The import org.apache cannot be resolved的错误:
【解决过程】
1.这里:
求救,eclispe开发不能import org.apache 包
和
The import org.apache cannot be resolved
都说到了,让去:
project -> Build Path -> Configure Build Path -> Libraries -> Add External Jar’s但是坑爹的却是,没有说,此处的
org.apache
是属于哪个jar包。
2.既然找不到
org.apache
那么,鉴于我此处,全部都是:
即,全都是:
org.apache.http
那就先去找org.apache.http。
3.参考:
请问谁有org.apache.http这个包
突然想到,貌似这个:
org.apache.http
是对应的android里面的,不是标准的java库中的。
4.所以,去到别人说的,apache官网中找这个库。
搜:
download org.apache.http
而找到http://hc.apache.org/downloads.cgi,去下载
HttpClient 4.2.5.zip
解压后,得到:
httpcomponents-client-4.2.5-bin\httpcomponents-client-4.2.5\lib
下面有很多jar:
先加进来试试:
然后所有的org.apache.http就正常了:
【总结】
org.apache,不是标准的java中的库。所以eclipse中,无法自动识别。
org.apache下包括了一堆相关的库,此处用到的的是org.apache.http,所以:
需要找到对应的org.apache.http相关的jar包,然后加到当前的项目中。
1.到哪里找org.apache.http
去apache官网中的:
http://hc.apache.org/downloads.cgi
去下载:
HttpClient 4.2.5.zip
即可,下载后,解压,可以在:
httpcomponents-client-4.2.5-bin\httpcomponents-client-4.2.5\lib中看到对应的各个jar包:
commons-codec-1.6.jar
commons-logging-1.1.1.jar
fluent-hc-4.2.5.jar
httpclient-4.2.5.jar
httpclient-cache-4.2.5.jar
httpcore-4.2.4.jar
httpmime-4.2.5.jar
2.如何把jar加到当前项目
详见:
【教程】如何给Eclipse中添加库(jar包)
http://www.crifan.com/java_eclipse_the_import_org_apache_cannot_be_resolved/
- Eclipse的java代码出错:The import org.apache cannot be resolved
- Eclipse的java代码出错:The import org.apache cannot be resolved
- 【已解决】Eclipse的java代码出错:The import org.apache cannot be resolved
- Eclipse的java代码出错:The import org.apache cannot be resolved
- Eclipse的java代码出错:The import org.apache cannot be resolved
- Eclipse的java代码出错:The import org.apache cannot be resolved
- Eclipse的java代码出错:import org.apache cannot be resolved
- Eclipse的java代码出错:The import XXXX cannot be resolved
- eclipse提示The import org.apache.hadoop.hbase cannot be resolved的解决方法
- ERROR: The import org.apache.commons.logging cannot be resolved
- The import org.apache.struts cannot be resolved
- The import org.apache.struts cannot be resolved
- the import org.apache.juli cannot be resolved
- The import org.apache.commons.codec cannot be resolved
- The import org.apache.xpath cannot be resolved
- The import org.apache.commons cannot be resolved in eclipse juno
- The import org.apache.commons cannot be resolved 的报错
- 遇到The import org.apache.commons cannot be resolved 的报错
- c++中static成员函数、成员变量作用
- block,inline和inline-block概念和区别
- 自定义滚轮事件
- 第八届福建省大学生程序设计竞赛 FZU 2273 Triangles (计算几何)
- spring学习之@Autowired
- Eclipse的java代码出错:The import org.apache cannot be resolved
- 排序的基本原理以及Java实现
- 慕课网学习之Java集合框架
- [LeetCode]419. Battleships in a Board
- createTrackbar函数使用
- The Suspects POJ
- 360浏览器的小功能——标题栏
- static、const总结
- python 案例 012(snake)