Eclipse “cannot be resolved to a type” error
2014-11-29 20:29
429 查看
脑残了。。。
做分布式实验的时候把eclipse自动生成的bin文件夹中的 ” *.class “全部删掉了。。。
然后自己去javac生成” *.class “的时候报了这样N个错误
(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自动生成的bin文件夹中的 ” *.class “全部删掉了。。。
然后自己去javac生成” *.class “的时候报了这样N个错误
“XXX cannot be resolved to a type” error
然后巨抑郁的去度娘,得到的总结原因如下(我自己就是错在了第三个错误,解决的方法是神奇的clean项目):(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 “cannot be resolved to a type” error
- Eclipse导入其他Eclipse写的Android项目error:Activity cannot be resolved to a type
- 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
- Maven项目中提示: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的JSP页面提示Multiple annotations found at this line或者String cannot be resolved to a type
- "XX cannot be resolved to a type "eclipse报错及解决说明
- eclipse 开发环境下,提示 String cannot be resolved to a type