如何使用最新的JVM构建xerces

编程入门 行业动态 更新时间:2024-10-28 17:18:48
如何使用最新的JVM构建xerces-j 2.11?(How to build xerces-j 2.11 with an up-to-date JVM?)

我已经从https://svn.apache.org/repos/asf/xerces/java/tags/Xerces-J_2_11_0查看了xerces-j 2.11。 现在我想构建它,但是在编译期间我收到以下错误:

compile: [xjavac] Compiling 596 source files to C:\Users\abrieg\workingcopy\xerces-trunk\build\classes [xjavac] C:\Users\abrieg\workingcopy\xerces-trunk\build\src\org\apache\html\dom\HTMLFrameElementImpl.java:28: error: HTMLFrameElementImpl is not abstract and does not override abstract method getContentDocument() in HTMLFrameElement [xjavac] public class HTMLFrameElementImpl [xjavac] ^ [xjavac] C:\Users\abrieg\workingcopy\xerces-trunk\build\src\org\apache\html\dom\HTMLIFrameElementImpl.java:28: error: HTMLIFrameElementImpl is not abstract and does not override abstract method getContentDocument() in HTMLIFrameElement [xjavac] public class HTMLIFrameElementImpl [xjavac] ^ [xjavac] C:\Users\abrieg\workingcopy\xerces-trunk\build\src\org\apache\html\dom\HTMLObjectElementImpl.java:28: error: HTMLObjectElementImpl is not abstract and does not override abstract method getContentDocument() in HTMLObjectElement [xjavac] public class HTMLObjectElementImpl [xjavac] ^ [xjavac] Note: Some input files use or override a deprecated API. [xjavac] Note: Recompile with -Xlint:deprecation for details. [xjavac] Note: Some input files use unchecked or unsafe operations. [xjavac] Note: Recompile with -Xlint:unchecked for details. [xjavac] 3 errors

问题是xjavac任务不使用/tools/xml-apis.jar中的类,而是使用jdk的rt.jar 。 编译在以下VM中运行:

java version "1.8.0_31" Java(TM) SE Runtime Environment (build 1.8.0_31-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

我已经使用了xml-apis.jar书库覆盖机制将xerces-j 2.11的xml-apis.jar放入VM中,但这不起作用。

xjavac调用定义为

<xjavac srcdir="${build.src}" destdir="${build.dest}" source="${javac.source}" target="${javac.target}" classpath="${build.dir}/classes:${tools.dir}/${jar.apis}:${tools.dir}/${jar.resolver}:${tools.dir}/${jar.serializer}" debug="${debug}" debuglevel="${debuglevel}" deprecation="${deprecation}" optimize="${optimize}" includeAntRuntime="false" includeJavaRuntime="false" excludes="org/xml/sax/** javax/xml/** org/w3c/dom/* org/w3c/dom/bootstrap/** org/w3c/dom/events/** org/w3c/dom/ls/** org/w3c/dom/html/** org/w3c/dom/ranges/** org/w3c/dom/traversal/** org/w3c/dom/views/** org/w3c/dom/xpath/**" />

如何确保xml-apis.jar用于编译而不是来自我的JVM的类?

I have checked out xerces-j 2.11 from https://svn.apache.org/repos/asf/xerces/java/tags/Xerces-J_2_11_0. Now I would like to build it, but I get the following errors during comilation:

compile: [xjavac] Compiling 596 source files to C:\Users\abrieg\workingcopy\xerces-trunk\build\classes [xjavac] C:\Users\abrieg\workingcopy\xerces-trunk\build\src\org\apache\html\dom\HTMLFrameElementImpl.java:28: error: HTMLFrameElementImpl is not abstract and does not override abstract method getContentDocument() in HTMLFrameElement [xjavac] public class HTMLFrameElementImpl [xjavac] ^ [xjavac] C:\Users\abrieg\workingcopy\xerces-trunk\build\src\org\apache\html\dom\HTMLIFrameElementImpl.java:28: error: HTMLIFrameElementImpl is not abstract and does not override abstract method getContentDocument() in HTMLIFrameElement [xjavac] public class HTMLIFrameElementImpl [xjavac] ^ [xjavac] C:\Users\abrieg\workingcopy\xerces-trunk\build\src\org\apache\html\dom\HTMLObjectElementImpl.java:28: error: HTMLObjectElementImpl is not abstract and does not override abstract method getContentDocument() in HTMLObjectElement [xjavac] public class HTMLObjectElementImpl [xjavac] ^ [xjavac] Note: Some input files use or override a deprecated API. [xjavac] Note: Recompile with -Xlint:deprecation for details. [xjavac] Note: Some input files use unchecked or unsafe operations. [xjavac] Note: Recompile with -Xlint:unchecked for details. [xjavac] 3 errors

The problem is that the xjavac task does not use the classes from the /tools/xml-apis.jar but instead uses rt.jar of the jdk. The compilation is running in the following VM:

java version "1.8.0_31" Java(TM) SE Runtime Environment (build 1.8.0_31-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

I already used the endorsed libraries override mechanism to put the xml-apis.jar of xerces-j 2.11 in the VM, but this didn't work.

The xjavac invocation is defined as

<xjavac srcdir="${build.src}" destdir="${build.dest}" source="${javac.source}" target="${javac.target}" classpath="${build.dir}/classes:${tools.dir}/${jar.apis}:${tools.dir}/${jar.resolver}:${tools.dir}/${jar.serializer}" debug="${debug}" debuglevel="${debuglevel}" deprecation="${deprecation}" optimize="${optimize}" includeAntRuntime="false" includeJavaRuntime="false" excludes="org/xml/sax/** javax/xml/** org/w3c/dom/* org/w3c/dom/bootstrap/** org/w3c/dom/events/** org/w3c/dom/ls/** org/w3c/dom/html/** org/w3c/dom/ranges/** org/w3c/dom/traversal/** org/w3c/dom/views/** org/w3c/dom/xpath/**" />

How can I make sure that xml-apis.jar is used for compilation instead of the classes from my JVM?

最满意答案

您需要将xml-apis.jar到Javac的引导类中。

<xjavac srcdir="${build.src}" destdir="${build.dest}" source="${javac.source}" target="${javac.target}" classpath="${build.dir}/classes:${tools.dir}/${jar.apis}:${tools.dir}/${jar.resolver}:${tools.dir}/${jar.serializer}" debug="${debug}" debuglevel="${debuglevel}" deprecation="${deprecation}" optimize="${optimize}" includeAntRuntime="false" includeJavaRuntime="false" excludes="org/xml/sax/** javax/xml/** org/w3c/dom/* org/w3c/dom/bootstrap/** org/w3c/dom/events/** org/w3c/dom/ls/** org/w3c/dom/html/** org/w3c/dom/ranges/** org/w3c/dom/traversal/** org/w3c/dom/views/** org/w3c/dom/xpath/**" > <compilerarg line="-Xbootclasspath/p:${tools.dir}/${jar.apis}"/> </xjavac>

You need to prepend the xml-apis.jar to the bootstrap classes of the Javac.

<xjavac srcdir="${build.src}" destdir="${build.dest}" source="${javac.source}" target="${javac.target}" classpath="${build.dir}/classes:${tools.dir}/${jar.apis}:${tools.dir}/${jar.resolver}:${tools.dir}/${jar.serializer}" debug="${debug}" debuglevel="${debuglevel}" deprecation="${deprecation}" optimize="${optimize}" includeAntRuntime="false" includeJavaRuntime="false" excludes="org/xml/sax/** javax/xml/** org/w3c/dom/* org/w3c/dom/bootstrap/** org/w3c/dom/events/** org/w3c/dom/ls/** org/w3c/dom/html/** org/w3c/dom/ranges/** org/w3c/dom/traversal/** org/w3c/dom/views/** org/w3c/dom/xpath/**" > <compilerarg line="-Xbootclasspath/p:${tools.dir}/${jar.apis}"/> </xjavac>

更多推荐

本文发布于:2023-07-20 12:32:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1199605.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   最新   xerces   JVM

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!