简体   繁体   English

ElementNSImpl 在 Eclipse 和 Java Zulu 11 中不起作用

[英]ElementNSImpl does not work in Eclipse with Java Zulu 11

EDIT编辑

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM