Reputation: 81
I working on a javafx project, and I have a problem when I try to use jlink to make my image. My java version : java 19 2022-09-20
Here is my module-info.java :
module org.aned.mosaic {
exports mosaic;
requires java.logging;
requires org.apache.commons.lang3;
requires java.xml.bind;
requires java.desktop;
requires transitive javafx.graphics;
requires transitive javafx.controls;
requires transitive javafx.fxml;
}
My jlink command :
jlink --output output/image --module-path "output/modules;C:\Program Files\Java\javafx-sdk-19\lib;C:\Users\alex_\.m2\repository\org\apache\commons\commons-lang3\3.12.0\commons-lang3-3.12.0.jar;C:\Users\alex_\.m2\repository\javax\xml\bind\jaxb-api\2.3.1\jaxb-api-2.3.1.jar" --add-modules org.aned.mosaic --launcher Mosaic=org.aned.mosaic
And the output :
Error: Module java.activation not found, required by java.xml.bind
java.lang.module.FindException: Module java.activation not found, required by java.xml.bind
at java.base/java.lang.module.Resolver.findFail(Resolver.java:892)
at java.base/java.lang.module.Resolver.resolve(Resolver.java:192)
at java.base/java.lang.module.Resolver.resolve(Resolver.java:141)
at java.base/java.lang.module.Configuration.resolve(Configuration.java:420)
at java.base/java.lang.module.Configuration.resolve(Configuration.java:254)
at jdk.jlink/jdk.tools.jlink.internal.Jlink$JlinkConfiguration.resolve(Jlink.java:217)
at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.createImageProvider(JlinkTask.java:536)
at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.createImage(JlinkTask.java:424)
at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.run(JlinkTask.java:276)
at jdk.jlink/jdk.tools.jlink.internal.Main.run(Main.java:56)
at jdk.jlink/jdk.tools.jlink.internal.Main.main(Main.java:34)
As I understand, the issue is with the java.xml.bind module, that use java.activation module, and it seem this module does not exists in java 19.
I tried to download jaf-1.1.1, and use the activation.jar file as a module, with no success
I tried too to add in the module-info.java "requires java.activation;"
I'm new to java modules, maybe I miss something. Is there a way to create an image from a module that use java.xml.bind?
Thanks,
Upvotes: 0
Views: 500
Reputation: 10640
Trying to use jlink to directly create the executable image is not a good idea because in almost every serious project you will have to deal with code which is not yet modularized and thus will not work with jlink. For an alternative have a look here, e.g.: https://github.com/dlemmermann/JPackageScriptFX
Upvotes: 0