I'm trying to create native images from different projects and I'm stuck on a particular case. This project uses JavaFX and this is necessary for it to work.
The heart of the problem is that at the end of the process once the executable has been launched it does not find the essential function com.sun.javafx.application.LauncherImpl present in the javafx.graphics module
After downloading a portable version of JavaFX I was able to integrate its modules into native-image with the command: native-image --module-path $env:MODULE:PATH (or %MODULE_PATH% with the cmd, the result is the same ) --add-modules [javafx.modules] --list-modules
However after creating the executable via the command: native-image --module-path $env:MODULE_PATH --add-modules [javafx.modules] --no-fallback -cp "classes;lib/*" com.app. Main" once the new executable is launched it crashes directly and gives me this error: "Exception in thread "main" java.lang.NoClassDefFoundError: com.sun.javafx.application.LauncherImpl at com.app.Main.main (Main. java:34) at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Since these modules are clearly indicated as present and integrated into GraalVM by the first command, do you have any idea why the -add-modules command when creating the native-image seems to have no effect?
Thank you in advance for your answer
I fix it by adding --add-export javafx.graphics/com.sun.javafx.application=ALL-UNNAMED