`
wusuoya
  • 浏览: 637718 次
  • 性别: Icon_minigender_2
  • 来自: 成都
社区版块
存档分类
最新评论

Eclipse “cannot be resolved to a type” error

    博客分类:
  • web
 
阅读更多

 

引言: 

    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.

分享到:
评论

相关推荐

    java eclipse 出现 xxx cannot be resolved to a type 错误解决方法

    Java Eclipse 出现 "xxx cannot be resolved to a type" 错误解决方法 Java Eclipse 是一个功能强大且广泛使用的集成开发环境(IDE),但是在使用过程中可能会出现各种错误信息,例如 "xxx cannot be resolved to a...

    详解 问题:HttpServlet cannot be resolved to a type

    在开发Java Web应用程序时,你可能会遇到一个常见的错误:“HttpServlet cannot be resolved to a type”。这个错误通常发生在尝试使用`HttpServlet`类时,而Eclipse IDE无法找到对应的类定义。`HttpServlet`是Java ...

    测试类报错Test cannot be resolved to a type-附件资源

    测试类报错Test cannot be resolved to a type-附件资源

    httpcomponents-client-4.5.5-bin和src_20180518.zip

    > ★BasicNameValuePair cannot be resolved to a type > ★HttpPost cannot be resolved to a type > ★NameValuePair cannot be resolved to a type > ★HttpClient cannot be resolved to a type > ★Http cannot...

    JSON-java-master.zip

    JSONObject cannot be resolved to a type 是因为缺少对应的依赖包:org-json.rar 包的来源github的项目:https://github.com/stleary/JSON-java中的Readme可以找到依赖包的地址。

    导入工程的“The import android cannot be resolved”错误解决方法

    在进行Android应用开发时,尤其是使用Eclipse作为集成开发环境(IDE)时,开发者可能会遇到一个常见的错误:“The import android cannot be resolved”。这个错误通常发生在尝试导入或打开一个已存在的Android项目...

    The import com.loopj cannot be resolved 的解决方案

    在编程过程中,我们时常会遇到各种编译错误,其中一种常见的问题是"The import com.loopj cannot be resolved"。这个错误信息表明你的项目无法找到`com.loopj`包,这通常是由于缺少必要的库文件导致的。`com.loopj`...

    estableRuntimeException cannot be resolved 解决

    在Java编程环境中,我们经常会遇到编译错误提示“XXX cannot be resolved”,这通常意味着系统无法找到指定的类或方法。在这种情况下,"org.apache.commons.lang.exception.NestableRuntimeException cannot be ...

    解决The type org.springframework.dao.support.DaoSupport cannot be resolved.bao报错

    在开发Spring框架相关的Java应用时,可能会遇到"The type org.springframework.dao.support.DaoSupport cannot be resolved"的错误提示。这个错误通常意味着编译环境无法找到`DaoSupport`类,这是Spring DAO模块中的...

    rsslib4j-0.2.jar jar包,解决java报错找不到资源包问题 The import org.gnu cannot be resolved

    rsslib4j-0.2.jar jar包,解决java报错找不到资源包问题 The import org.gnu cannot be resolved。 报错 import org.gnu.stealthp.rsslib.*; RSSChannel、RSSException、RSSHandler、RSSItem、RSSParser

    variable name cannot be resolved(解决方案).md

    variable name cannot be resolved(解决方案).md

    *Renderer implements TableCellRenderer

    在Java Swing中,`TableCellRenderer` 是一个接口,它在创建和显示JTable组件中的单元格内容时扮演着至关重要的角色。标题“*Renderer implements TableCellRenderer”表明我们正在讨论一个自定义的渲染器,该渲染器...

    Word模板-授权委托书.wpt

    Word模板-授权委托书.wpt

    commons-lang3-3.1.jar

    当你在项目中遇到"The import org.apache.commons.lang3 cannot be resolved"的错误时,通常是因为缺少了这个库的引用,导致你的代码无法找到所需的类。 `org.apache.commons.lang3`是该库的主要包名,其中包含了...

    java错误提示英汉对照

    - **Type型别**:指数据类型,如整型(int)、浮点型(float)等。 - **Generalized泛化**:表示一般化,即一个类继承另一个类的特性。 - **Specialized特化**:表示特殊化,即一个类继承另一个类后增加或修改了一些特性...

    Calendar类--Eclipse

    在Eclipse环境下,开发者可以方便地使用这些功能,同时Eclipse IDE还提供了代码补全和调试工具,使得在处理日期和时间问题时更加高效。在编写涉及日期和时间处理的程序时,`Calendar`类是一个不可或缺的工具。 `...

    eclipse_workspace设置

    Eclipse是一个广泛使用的Java集成开发环境(IDE),它支持多种编程语言,如Java、Python、C++等。在Eclipse中,"workspace"是开发者进行项目管理的核心概念,它是存储项目、配置信息以及Eclipse工作相关数据的地方。...

    apache-ant-1.8.2.jar

    The type org.apache.tools.ant.Task cannot be resolved. It is indirectly referenced from required .class files错误....., 解决办法:在工程中加入此jar包

Global site tag (gtag.js) - Google Analytics