8

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

Paul Taylor
  • 13,411
  • 42
  • 184
  • 351
  • Very late response to this, but for anyone else who comes across this, we found this to work for `--add-opens` if and only if using an equals-sign instead of a space to join it into a single argument: `--add-opens=java.base/java.util=ALL-UNNAMED`. It may be the same for `--add-modules`. – Mike Hill Sep 06 '22 at 21:13

1 Answers1

1

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>
Paul Taylor
  • 13,411
  • 42
  • 184
  • 351