The type XXX cannot be resolved. It is indirectly referenced from required .class files错误.

Posted linus-tan

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了The type XXX cannot be resolved. It is indirectly referenced from required .class files错误.相关的知识,希望对你有一定的参考价值。

https://blog.csdn.net/linyeban/article/details/53812641

在Eclipse中遇到The type XXX cannot be resolved. It is indirectly referenced from required .class files错误.....,查找的解决办法如下:

一: 
It is indirectly referenced from required .class file

 

原因:你正要使用的类调用了另一个类,而这个类又调用了其他类,这种关系可能会有好多层。而在这个调用的过程中,某个类所在的包的缺失就会造成以上那个错误。

解决方法:导入缺失的包。如果是maven情况下的话,可能是本地仓库的的xxx文件出错了,删掉它,重新依赖,重新下载就可以了

二:
The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project 

The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files

 

出現以上訊息的原因是因為你裝了多個版本的jre或jdk的關係。本來Eclipse在建立專案時,會自動參照你的jre路徑,但多個版本就沒辦法了。 
你只能手動建立… 
1. 進入windowpreferencesjavaInstalled JREs 
1)按Add 
2)輸入JRE Name,例JDK1.5.0.03 
3)JRE home directory, 選擇安裝的路徑 
4)按OK 
2. 進入ProjectpropertiesJava Bulid Path 
1)Add library 
2)選JRE System Library後按Next 
3)選workplace default JRE後按finish...
————————————————
版权声明:本文为CSDN博主「linyeban」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/linyeban/article/details/53812641

以上是关于The type XXX cannot be resolved. It is indirectly referenced from required .class files错误.的主要内容,如果未能解决你的问题,请参考以下文章

[Java] The imoprt XXX cannot be resolved

eclipse 导入类 提示The import XXX cannot be resolved

在overleaf上使用LaTeX写中文论文出现错误:The font “XXX” cannot be found

XXX cannot be resolved to a type

xxx cannot be resolved to a type 错误解决方法

杂-The type java.lang.Object cannot be resolved It is indirectly referenced ...