Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using a splash screen interferes with the class loader used by JavaFX #66

Open
dlemmermann opened this issue Apr 12, 2022 · 5 comments
Open

Comments

@dlemmermann
Copy link

Our app was working perfectly fine, then I added a splash screen. After that the default class loader used by JavaFX was null. See method getDefaultClassLoader() in FXMLLoader.java. This caused our app to crash as soon as it tried to create a view via FXML. At first I thought it is caused by the short snippet used to close the splash screen (as it probably ran on the wrong thread), but even after commenting that out the app would still crash. It was only after I completely removed the splash screen from the jdeploy package that our app started working again.

@shannah
Copy link
Owner

shannah commented Apr 12, 2022

Perhaps the -splash:splash.gif command-line switch isn't compatible with JavaFX. I can't find anything confirming this yet, but I see lots of posts of people extending javafx.application.Preloader to make a splash screen. E.g. https://stackoverflow.com/questions/69237024/javafx-splashscreen-with-an-animated-gif

@dlemmermann
Copy link
Author

Yes, Preloaders are the way to do it for JavaFX applications. But then I guess it becomes my responsibility to provide it ....?

@shannah
Copy link
Owner

shannah commented Apr 12, 2022

This is good to know. Since the installer app uses a splash image, I'll have to keep this in mind as we add support for installer themes written in JavaFX.

@shannah
Copy link
Owner

shannah commented Apr 18, 2022

I added a note to the manual:

NOTE: jDeploy uses the `-splash:splash.gif` CLI argument at runtime to add the splash screen.  
This https://github.com/shannah/jdeploy/issues/66[apparently causes some issues with JavaFX].  
Currently, the recommendation for adding splash screens to JavaFX apps is to use a Preloader.  https://blog.codecentric.de/en/2015/09/javafx-how-to-easily-implement-application-preloader-2/[Example here].

Will leave this open, as there may be other solutions for splash-screen that I can explore, such as spawning a separate "splash screen" process from the launcher to display the splashscreen while the app loads.

@RouHim
Copy link

RouHim commented Apr 25, 2023

Ok one year later I'm facing the same issue, is there any known workaround beside removing the splash screen? Is there anything we could help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants