"XX cannot be resolved to a type "eclipse报错及解决说明

简介: <p>转自:<a target="_blank" href="http://zhaoningbo.iteye.com/blog/1137215">http://zhaoningbo.iteye.com/blog/1137215</a></p> <p><span style="font-family:Helvetica,Tahoma,Arial,sans-serif; font-size:

转自:http://zhaoningbo.iteye.com/blog/1137215

引言: 

    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目录),导致类型查找不到。 


    (完结) 

目录
相关文章
|
Java Android开发
Eclipse里面导工程的时候报错faceted project problem
Eclipse里面导工程的时候报错faceted project problem
|
应用服务中间件 Android开发
Eclipse报错,unable to install breakpoint in ...
Eclipse报错,unable to install breakpoint in ...
1222 0
|
Java Android开发
eclipse 导入项目源码报错(最全问题及解决方案)
我们在使用 eclipse 导入源码时,经常会出现一些意想不到的问题,出现各种报错或者是乱码,这里我汇总了eclipse导入项目出现问题的方法及解决方案,希望能帮助到大家
1141 0
eclipse 导入项目源码报错(最全问题及解决方案)
|
6月前
|
Java Android开发
eclipse导入项目时,报错:One or more cycles were detected in the build path of project ....
eclipse导入项目时,报错:One or more cycles were detected in the build path of project ....
322 60
|
Java Android开发
Eclipse启动报错:org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javax/annotat
Eclipse启动报错:org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javax/annotat
949 0
Eclipse启动报错:org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javax/annotat
|
IDE Java 程序员
Eclipse 安装插件报错:An error occurred while collecting items to be installed session context was...解决方法汇总
Eclipse 安装插件报错:An error occurred while collecting items to be installed session context was...解决方法汇总
1131 0
Eclipse 安装插件报错:An error occurred while collecting items to be installed session context was...解决方法汇总
|
IDE 编译器 程序员
Eclipse 的常见报错、警告和原因分析、解决方式以及相关操作快捷键小结(持续更新)
Eclipse 的常见报错、警告和原因分析、解决方式以及相关操作快捷键小结(持续更新)
739 0
|
10月前
|
Android开发
eclipse报错问题解决
eclipse报错问题解决
|
Java Android开发
eclipse项目报错的解决方案
eclipse项目报错的解决方案
88 0
|
Java Android开发 Windows
成功解决eclipse启动报错 Error:Could not create the Java Virtual Machine Error:A fatal exception has occurred
成功解决eclipse启动报错 Error:Could not create the Java Virtual Machine Error:A fatal exception has occurred