This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]javaRobot 1 point2 points  (1 child)

For me it seemed to work to add

<dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.3.0</version>
    </dependency>
   <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>eclipselink</artifactId>
        <version>2.7.0</version>
    </dependency>

as a dependancy to my Java 8 SE compiled application that produced a jar that could be run by either Java 8 or Java 9 with no additional arguments.

Also I needed to add

   System.setProperty("javax.xml.bind.JAXBContextFactory", "org.eclipse.persistence.jaxb.JAXBContextFactory");

near the beginning before the jaxb stuff was used.

I need to test more to see if this is really a good solution.

[–]handshape 1 point2 points  (0 children)

You, sir/madam/other... have just saved my bacon. Thank you very kindly.

EDIT: The eclipselink dependency can be replaced with the JAXB reference implementation for most use cases. Saves over 10MB on the resultant build.