jdk:17.0.8 Mave:3.8.8
- I want to use GraalVM to package the native image, see GraalVM website Use the "native image-jar App.jar" command easy to generate a native image. The premise is that need to build JavaFX programs as executable jar files.
- Follow the JavaFX guide to build using the "javafx-maven-plugin",But it builds out a zip, not a jar file.
- Then I tried to build with "maven-jar-plugin" and "maven-assembly-plugin" plugins, which were able to output the executable jar file, but both had the same problem when executing :Error: JavaFX runtime component is missing and needs to be used to run this application
- The problem is the same as his
- My goal is to use GraalVM to build a nativa image of JavaFX. What is the best way to do this
the code is IntelliJ IDEA auto generate,use IntelliJ IDEA run is normal
public class HelloApplication extends Application {
@Override
public void start(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("hello-view.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 320, 240);
stage.setTitle("Hello!");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch();
}
}