Eclipse “cannot be resolved to a type” error
来源:互联网 发布:双系统软件 编辑:程序博客网 时间:2024/05/29 03:26
引言:
eclipse新导入的项目经常可以看到“XX cannot be resolved to a type”的报错信息。本文将做以简单总结。
正文:
(1)jdk不匹配(或不存在)
项目指定的jdk为“jdk1.6.0_18”,而当前eclipse使用的是“jdk1.6.0_22”。需要在BuildPath | Libraries,中做简单调整。
(2)jar包缺失或冲突
当找不到“XX”所在的jar包时,会报这个错。解决只需要找到(ctrl+点击,可能能看到jar包名称)对应jar包导入项目即可。
另外,出现相同的XX时也会报此错。可能需要调包、解包、选删。
(3)eclipse查找项目类型策略所致
eclipse下,上述两条都对比过了,没有任何问题,可偏偏还报这错。这时,需要操作一下 Project | Clean... ,问题即可解决。原因是,机制所致。因为某些特殊原因,eclipse没能自动编译源代码到build/classes(或其他classes目录),导致类型查找不到。
eclipse新导入的项目经常可以看到“XX cannot be resolved to a type”的报错信息。本文将做以简单总结。
正文:
(1)jdk不匹配(或不存在)
项目指定的jdk为“jdk1.6.0_18”,而当前eclipse使用的是“jdk1.6.0_22”。需要在BuildPath | Libraries,中做简单调整。
(2)jar包缺失或冲突
当找不到“XX”所在的jar包时,会报这个错。解决只需要找到(ctrl+点击,可能能看到jar包名称)对应jar包导入项目即可。
另外,出现相同的XX时也会报此错。可能需要调包、解包、选删。
(3)eclipse查找项目类型策略所致
eclipse下,上述两条都对比过了,没有任何问题,可偏偏还报这错。这时,需要操作一下 Project | Clean... ,问题即可解决。原因是,机制所致。因为某些特殊原因,eclipse没能自动编译源代码到build/classes(或其他classes目录),导致类型查找不到。
Based on the comments here, I started checking how I could make sure that my Ant build
wouldn’t interfere with my Eclipse build.
I found an option in Eclipse that clears up the problem (and is possibly more efficient than
changing the 2 build system’s output folders).
Windows–>Preferences–>Java–>Compiler–>Building–>Output folder–>
”Rebuild class files modified by others”. This exists in Eclipse 3.5; I’m not sure about earlier versions.
Checking this seems to have fixed my problems.
0 0
- Eclipse “cannot be resolved to a type” error
- Eclipse “cannot be resolved to a type” error
- Eclipse “cannot be resolved to a type” error
- Eclipse “cannot be resolved to a type” error
- Eclipse “cannot be resolved to a type” error
- Eclipse “cannot be resolved to a type” error
- Eclipse “cannot be resolved to a type” error
- Eclipse “cannot be resolved to a type” error
- ECLIPSE “CANNOT BE RESOLVED TO A TYPE” ERROR
- Eclipse “cannot be resolved to a type” error
- Eclipse “cannot be resolved to a type” error
- Eclipse “cannot be resolved to a type” error
- Eclipse “cannot be resolved to a type” error
- Eclipse “cannot be resolved to a type” error
- “cannot be resolved to a type” error
- Eclipse “cannot be resolved to a type”
- Eclipse导入其他Eclipse写的Android项目error:Activity cannot be resolved to a type
- ERROR:OnClickListener cannot be resolved to a type
- 如何计算某一天是星期几?
- 修改JBoss6.1和Apacheservicemix的端口
- C# 窗口间传递参数(转载)
- iOS7 UI改变总结
- 学习ASP.NET MVC5框架揭秘笔记-ASP.NET路由(九)
- Eclipse “cannot be resolved to a type” error
- 个人PHP学习笔记(六)--字符串
- iOS 开发中的争议(二)
- 设置数据库自动增长注意要点
- 打开资源文件时显示说没有安装这个ActiveX控件 "{648A5600-2C6E-101B-82B6-000000000014
- vimdiff的常用命令
- 苏梅岛中文离线地图App上线
- nefu2哥德巴赫猜想 素数筛
- python scrapy的一点杂谈