JavaFX artifact .exe does not show any window
Hello everyone,
I'm currently trying to build a JavaFX application.
In order to bundle it as .exe I wanted to use artifacts.
And everything works fine, except for the window.
That means: When I execute the .exe file, my code starts running and it is doing its thing. But when it is done with preprocessing, it does not show the window.
To isolate this problem, i deactivated everything from the code, except the part, where the window is created, loaded, and displayed. I get no warnings, no erros, nothing. When I call the .class file from the console or just run it out of the editor it works fine.
I also tried packaging as .jar, but the same problems persists.
Java Version: 8
JavaFX version: 2
The code:
Parent root = null;
FXMLLoader loader = new FXMLLoader(getClass().getResource("../fxml/ui.fxml"));
try {
root = loader.load();
} catch (Exception e) {
System.err.println("ERROR: MusicManager: LOAD FXM " + e);
System.exit(-1);
}
uiController = loader.getController();
uiController.setManager(this);
// Creating a scene object
@NotNull Scene scene = new Scene(root, 600, 300);
//mediaView = new MediaView();
// ((Group) scene.getRoot()).getChildren().add(mediaView);
//Setting title to the Stage
primaryStage.setTitle("Musicplayer");
scene.setFill(null);
//Adding scene to the stage
primaryStage.setScene(scene);
primaryStage.setWidth(648);
primaryStage.setHeight(457);
primaryStage.setMaxHeight(457);
primaryStage.setMaxWidth(648);
primaryStage.setMinHeight(457);
primaryStage.setMinWidth(648);
//Displaying the contents of the stage
primaryStage.show();
And here are the JavaFX artifact settings:

I hope someone has an idea,
Thanks in advance
Luca
Please sign in to leave a comment.
>But when it is done with preprocessing, it does not show the window.
Please elaborate.
Okay I fixed it
(i hate my life :/ )
So the fix was, that JavaFX cannot show the window, if the .fxml file in another package which is not the package of the Application class