Right way to hand over from JavaFX bootstrap to business app
See original GitHub issueIn the example you have this javafx splash screen example where user launches delegate.jar and it downloads updates and launches business app.
I have build something similar; I have separate Updater app which also functions as installer with javafx gui using update4j-1.2.2.jar, running update logic in different thread and a CustomUpdateHandler updating javafx gui as it goes while showing user info on the currently downloading updates, then after update logic is finished, separate business app in run new jvm and updater does System.exit(0);
I’m wondering if this is an OK way to do it or should I implement it in an other way? Since the updater logic already does an javafx launch I can no longer use Configuration.launch after that am I rite?
Also I’m still a bit unclear on what needs to be done if the updater app itself requires updates, since the updaterapp jar will be locked while it is running.
Runtime run = Runtime.getRuntime(); Process process = run.exec("java -jar BUSINESSAPP.jar"); System.exit(0);
Issue Analytics
- State:
- Created 5 years ago
- Comments:71 (32 by maintainers)
Top GitHub Comments
I am currently working on a demo application that shows many details of update4j. Hope to get it done in a week or 2.
To migrate from standard to delegate mode, all you need is to implement Delegate and move your main method logic in the interface implementation. Next you should ‘advertise’ the delegate as a service provider as explained in the wiki. Make sure the jar is present in the class/module path for the framework to find the delegate.
To implement your own file-download logic, you can override the default logic by implementing the ‘connect()’ method in UpdateHandler. You can then directly pass an instance of the update handler to the Configuration::update method, or provide it as a service.
Btw, I’m planning on renaming the ‘connect()’ method to ‘openDownloadStream()’ on the next release; just be aware of this.
As Christian said, you should use system properties.
if relying on user.dir is to brittle (user might move working directory) you may use user.home plus some known path to your installation.
if you want a platform dependent path, you may use properties (that can specify which OS that property should target) with different values for each operating system (by reusing the same property key and targeting different os) and refer to that property in the base path.