The type java.lang.reflect.AnnotatedElement cannot be resolved. It is indirectly referenced from req

JDK从1.7切换到1.8,Myeclipse10.0导入之前运行正常的工程提示如下错误:

Description Resource    Path    Location    Type
The project was not built since its build path is incomplete. Cannot find the class file for java.lang.reflect.AnnotatedElement. Fix the build path then try building this project  analysis_system     Unknown Java Problem
Description Resource    Path    Location    Type
The type java.lang.reflect.AnnotatedElement cannot be resolved. It is indirectly referenced from required .class files  SpringContextsUtil.java /analysis_system/src/main/java/cn/geekview/analysisSystem/utils line 1  Java Problem

解答:

When using JDK 8 and an IDE with its own compiler, like Eclipse, you have to update the IDE to a version with Java 8 support, even if you are not using the newer Java 8 features.

The reason is that the compiler must be able to load the newer class files of the JRE in order to compile your software which references these classes.

Sometimes you can get away with an older compiler when it ignores the newer version number of the class files. But some types will confuse older class file parsers as they use new features, notably AnnotatedElement, which now has default methods, and Map.Entry, an interface which now has static methods.

It seems that Eclipse does not make a difference between references for which no class file could be found and class files it failed to read when saying “«classname» cannot be resolved”.

实际上就是Myeclipse的版本太低不支持JDK1.8,所以更新开发工具的版本即可解决,我个人切换到IDEA上运行就解决这个问题了!

地址:https://stackoverflow.com/questions/26102115/error-when-using-logmanager-l4j2-with-java-8-java-lang-reflect-annotatedeleme

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值