Over a million developers have joined DZone.

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

What every Java engineer should know about microservices: Reactive Microservices Architecture.  Brought to you in partnership with Lightbend.

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.

Microservices for Java, explained. Revitalize your legacy systems (and your career) with Reactive Microservices Architecture, a free O'Reilly book. Brought to you in partnership with Lightbend.

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

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

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

{{ parent.tldr }}

{{ parent.urlSource.name }}