How to run code that uses JAXB in Java 1.9 when deployed through Java Web Start

I have three applications that I deploy using Java Web Start for clients. All three of these applications use JAXB. In Java 1.9, to load the jaxb module, you should use:

--add-modules java.xml.bind

Java Web Start lets you pass VM arguments to applications with the java-vm-args attribute of the java / j2se tag. However, only the arguments listed in the documentation are supported, and is --add-modulesnot on this list .

So, the question is, how do you transfer "--add-modules java.xml.bind"to 1.9 VM when you run code through Java Web Start that uses JAXB?

Here is what I tried, and my testing shows that -add-modules is really not supported by the java-vm-arg attribute:

<resources>
    <property name="jnlp.packEnabled" value="true"/>
    <java version="9" java-vm-args="--add-modules java.xml.bind"/>
    <java version="1.8+"/>
    <jar href="redacted.jar"/>
</resources>
+4
3

, Java EE, d9 --add-modules Java 9, , JAXB JDK . JAXB API , ANT + Ivy, , :

 <dependency org="org.glassfish.jaxb" name="jaxb-runtime" rev="2.3.0"/>
 <dependency org="org.glassfish.jaxb" name="jaxb-core" rev="2.3.0"/>
 <dependency org="javax.xml.bind" name="jaxb-api" rev="2.3.0"/>
 <dependency org="javax.activation" name="activation" rev="1.1.1"/> 

(FastInfoset, istack-commons, stax-ex txw2). , jar , , 200 600 .

Java 9. , , .

+2

, . - "java.xml.bind". java-vm-args="--add-modules=java.xml.bind".

+1

, , 9 9+ (ea builds), :

<resources> 
    <property name="jnlp.packEnabled" value="true"/>
    <j2se version="9" java-vm-args="--add-modules java.xml.bind"/>
    <j2se version="1.8+"/>
    <jar href="redacted.jar"/>
</resources>

The default version attribute refers to the platform version (specification version) of the Java Platform Standard Edition platform. Platform versions 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, and 9 are currently defined. (The platform version usually does not contain the firmware version number, for example 1.4.2.)


I also did this and who answered earlier to explain a permanent solution instead of making such temporary fixes for code based on java.xml.bindthat is deprecated.

+1
source

Source: https://habr.com/ru/post/1686358/


All Articles