简体   繁体   中英

JavaFX application does not compile well when using LauncherImpl instead Application

I have a JavaFX application which compiles to native using GluonFx plugin. I want to add a Preloader to show when starting. I managed it by changing the initialization from:

Application.launch(MainView.class, args) to LauncherImpl.launchApplication(MainView.class, MyPreloader.class, args)

The compilation process executes till the end with no errors, but the app doesn't boot. If I try to run the agent (mvn gluonfx:runagent) I have the following error: cannot access class com.sun.javafx.application.LauncherImpl (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.application to unnamed module

Someone knows how to solve this, or what other way can I use to load my Preloader?

PS: Running from the IDE works. The problem is after compilation to native

Thanks in advance

I've found the solution by using the answer in this ticket:

Java 9 JavaFX Preloader

Replaced: LauncherImpl.LauncherImpl.launchApplication(MainView.class, MyPreloader.class, args)

by

System.setProperty("javafx.preloader", MyPreloader.class.getCanonicalName());
Application.launch(MainView.class, args);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM