Search code examples
javawinrun4j

Unable to get vmargs identified in winrun4j ini file


I have just moved my application from Java8 to Java10, as part of that I now need to add

--add-modules java.xml.bind

to avoid java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

exception.

And this works fine in my batch file

JVM64\bin\java --add-modules java.xml.bind -cp lib;lang  -Xms150m -Xmx400m  -jar lib/SongKong-5.7.jar %1 %2 %3 %4 %5 %6 %7 %8 %9

but I cannot get my equivalent winrun4j .ini file to work

I have tried adding

vmarg.1=--add-modules java.xml.bind

and then tried

vmarg.1=--add-modules
vmarg.2=java.xml.bind

but neither had any effect, I still get the NoClassDefFoundError when run from winrun4j


Solution

  • I was unable to get this to work but I did find a solution to my problem. By deploying the jaxb jars with my application like I would with any 3rd party library I no longer need to use -add modules.

    Since I am building my application with maven, I had to add the following to the dependencies section of my pom.xml file.

            <dependency>
                <groupId>javax.xml.bind</groupId>
                <artifactId>jaxb-api</artifactId>
                <version>2.2.11</version>
            </dependency>
            <dependency>
                <groupId>com.sun.xml.bind</groupId>
                <artifactId>jaxb-core</artifactId>
                <version>2.2.11</version>
            </dependency>
            <dependency>
                <groupId>com.sun.xml.bind</groupId>
                <artifactId>jaxb-impl</artifactId>
                <version>2.2.11</version>
            </dependency>
            <dependency>
                <groupId>javax.activation</groupId>
                <artifactId>activation</artifactId>
                <version>1.1.1</version>
            </dependency>