JDK 10无法在Eclipse中导入javax.xml.namespace [英] JDK 10 cannot import javax.xml.namespace in Eclipse
问题描述
这很奇怪.我正在将一个动态Web项目从Java 8迁移到Java 10.
It's very strange. I am moving a dynamic web project from Java 8 to Java 10.
我无法解决依赖关系的最后一件事是javax.xml.namespace.QName类.
The last thing I cannot get the dependency resolved is the javax.xml.namespace.QName class.
在所附的屏幕快照中,您可以看到JRE系统库中存在QName类,但是IDE一直抱怨无法将QName解析为一种类型.
You can see in the attached screen shot, the QName class exist in JRE System Library, but the IDE keep complaining that QName cannot be resolved to a type.
推荐答案
尝试更改类路径上元素的顺序. JRE必须在Maven依赖项之前.解决了这个问题.
Try to change the order of elements on your classpath. The JRE must be before the Maven Dependencies. That fixes the issue.
我的猜测是Java 10编译器注意到您正在尝试用JAR中的代码替换内部类(java.xml.namespace
),并且它不是那样.
My guess is that the Java 10 compiler notices that you're trying to replace internal classes (java.xml.namespace
) with code from JARs and it doesn't like that.
这篇关于JDK 10无法在Eclipse中导入javax.xml.namespace的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!