Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Native JavaFX Apps With Automatic Updates: FXLauncher

DZone's Guide to

Native JavaFX Apps With Automatic Updates: FXLauncher

JavaFX is an awesome UI framework, but there can definitely be deployment issues. The Javapackager tool improves ease of native installer creation. Here's a quick overview of JavaFX applications with auto updates.

· Java Zone ·
Free Resource

Get the Edge with a Professional Java IDE. 30-day free trial.

JavaFX has become one of the greatest UI frameworks for modern desktops, but there are definitely issues when it comes to deployment. The Javapackager tool makes it easy to create native installers, but there is no support yet for auto updates. Java Web Start, on the other hand, can handle updates, but there is no native packaging.

FXLauncher combines native installers from Javapackager with an update mechanism similar to that of Java Web Start. You can use FXLauncher without native packaging as well, by distributing your application as a 14kb launcher jar that will download artifacts and keep them up to date as you deploy new versions.

Watch a small screencast here.

The launcher looks up a manifest (example here) that is used to synchronize local artifacts at startup. The user will see a spinner while the manifest is retrieved and a progress bar while any updates are downloading. The preloader then hands control over to your application, in-process. Launcher look and feel is configurable with CSS.

Spinner while Manifest is loadingApplication update in progress





The native installers do not contain any code, so you don't need to rebuild them when you release a new version of your application. Simply copy the app artifacts to the predefined location, and FXLauncher handles the rest.

FXLauncher will also handle polyglot apps. It works great with TornadoFX - the Kotlin JavaFX Framework.

Check out the GitHub Repo for more information and examples. There is also a demo application available. Although the examples are Maven based, there is nothing Maven specific about it - any build system can be used.

Get the Java IDE that understands code & makes developing enjoyable. Level up your code with IntelliJ IDEA. Download the free trial.

Topics:
javafx ,native app ,installer ,polyglot ,maven

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}