I've got a NetBeans 14 free-form project using Ant. It utilizes wsimport
in its build.xml
, and a lot of the targets depend on wsimport
. After ending up with several JDKs (at least 1.8 and 17) I'm having trouble building, from wsimport
chosing the wrong JDK.
In the build.xml
(extracts):
<taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
<classpath>
<pathelement location="${lib}/jaxws22/jaxws-tools.jar"/>
</classpath>
</taskdef>
<target name="wsimport">
<wsimport
wsdl="http://address/to/wsdl.xml"
catalog="${metainf}/jax-ws-catalog.xml"
destdir="${release}"
sourcedestdir="${src-gen}"
keep="true"
extension="true"
verbose="true">
<depends file="${metainf}/jax-ws-catalog.xml"/>
<depends file="${wsdl}/wsdl.xml"/>
<produces dir="${src-gen}"/>
</wsimport>
</target>
<target name="compile" depends="init,wsimport" description="compile the source">
<javac ... />
</target>
The problem is that when running wsimport
seems to select JDK17, while I want it to select JDK1.8. The output is this:
command line: wsimportC:\path\to\jdk-17.0.2\bin\java.exe ... http://address/to/wsdl.xml
Which gives:
java.lang.NoClassDefFoundError: com/sun/org/apache/xml/internal/resolver/CatalogManager
at com.sun.tools.ws.wscompile.WsimportOptions.parseArguments(WsimportOptions.java:317)
...
Which I've got down to not working with JDK 17. How can I make wsimport
use the correct JDK in this scenario?