[英]ElementNSImpl does not work in Eclipse with Java Zulu 11
I tried to do gradle build
and it gives me this error:我试图做
gradle build
,它给了我这个错误:
package com.sun.org.apache.xerces.internal.dom is declared in module java.xml, which does not export it
包 com.sun.org.apache.xerces.internal.dom 在模块 java.xml 中声明,不导出它
I inspected gradle dependencies
, but no one uses java.xml
我检查了
gradle dependencies
,但没有人使用java.xml
We use ElementNSImpl in only one part of our code (I don't know why...).我们只在一部分代码中使用了 ElementNSImpl(我不知道为什么......)。 Anyway, when I tried to switch to Java 11 Zulu, Eclipse gives me this error:
无论如何,当我尝试切换到 Java 11 Zulu 时,Eclipse 给了我这个错误:
The type com.sun.org.apache.xerces.internal.dom.ElementNSImpl is not accessible
类型 com.sun.org.apache.xerces.internal.dom.ElementNSImpl 不可访问
With OpenJDK 8 we have to import it using xerces:xercesImpl:2.6.2-jaxb-1.0.6
使用 OpenJDK 8,我们必须使用
xerces:xercesImpl:2.6.2-jaxb-1.0.6
导入它
I inspected the class with Eclipse and it's a public class, under the Zulu 11 jar.我用 Eclipse 检查了这个类,它是一个公共类,在 Zulu 11 jar 下。
As @Holger said in its comment and @AlanBateman said in its comment , com.sun.org.apache.xerces.internal.dom
is JDK-internal.正如@Holger 在其评论中和@AlanBateman 在其评论中所说的那样,
com.sun.org.apache.xerces.internal.dom
是 JDK 内部的。 You have simply to substitute com.sun.org.apache.xerces.internal.dom.ElementNSImpl
with org.w3c.dom.Element
您只需将
com.sun.org.apache.xerces.internal.dom.ElementNSImpl
替换为org.w3c.dom.Element
In my case changing the import to org.apache.xerces.dom.ElementNSImpl
worked.在我的情况下,将导入更改为
org.apache.xerces.dom.ElementNSImpl
工作。 Refer to https://xerces.apache.org/xerces-j/apiDocs/org/apache/xerces/dom/ElementNSImpl.html参考https://xerces.apache.org/xerces-j/apiDocs/org/apache/xerces/dom/ElementNSImpl.html
I'm using Red Hat openjdk 11 btw.顺便说一句,我正在使用 Red Hat openjdk 11。
Hope it helps.希望能帮助到你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.