Skip to content

hljlgj/fxlauncher

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FXLauncher

Maven Central Apache License

Auto updating launcher for JavaFX Applications. Combined with JavaFX native packaging, you get a native installer with automatic app updates.

You can see the launcher in action in this Demo Application.

QuickStart projects

Changelog

Check out the changelog for a list of all updates to the project.

Video demonstration

See the launcher in action in this short screencast. There is also a video about customizing the update user interface.

How does it work?

FXLauncher is a 18Kb jar that can be used to boot your application. It knows the location of your application repository where you host all the app resources.

See a manifest example here. FXLauncher will look up the remote repository to check for a newer version of the manifest on each startup.

After the manifest is retrieved, FXLauncher synchronizes every file mentioned in the manifest while providing the user with a progress indicator. After all resources are in sync, a classloader is initialized with all the resources from the manifest.

Lastly, the application entry point retrieved from the manifest is invoked. Everything happens in-JVM, no restarts needed.

Before each run, the launcher will synchronize all resources and seamlessly launch an always updated application.

How to use FXLauncher

See the QuickStart projects at the top of the README for information on integrating FXLauncher in your build system.

Adhoc usage

FXLauncher can also be used to launch an application at an arbitrary url by specifying the --app parameter at startup:

java -jar fxlauncher.jar --app=http://remote/location/app.xml

Native installers

The native installer does not contain any application code, only the launcher. There is no need to rebuild your native installer when you update your project, simply run the deploy-app goal and all users will run the newest version on their next startup. Point users to the fxlauncher.jar or to a native installer if you wish.

Try a native installer

Check out these prebuilt installers for a more complex demo application

Specify cache directory

By default, the artifacts are downloaded to the current working directory. This is usually fine for native installers, but if you distribute your application via just the launcher jar, you might want to specify where the downloaded artifacts land. See the cache dir documentationfor more information.

Accept downgrades

Starting from version 1.0.12, FXLauncher will not download a remote version if the local version is newer. This is controlled by comparing a timestamp in the manifest. Specifying --accept-downgrades=true as the last argument to CreateManifest will allow you to make sure that the version you have published will always be used by your clients even if they have a newer version installed. This option is also available in the Gradle plugin as acceptDowngrades.

A slimmer alternative

It is also possible to embed the launchar jar in a native installer system like Advanced Installer - same approach as above, but without using javapackager. With this approach, you can choose wether to include a JRE or have the installer software preinstall it. Again, you are only distributing the launcher with the native installer, the rest is pulled down on demand.

A note on classloaders

FXLauncher uses a custom classloader to dynamically load the synchronized resources. This classloader is then made available to the FXMLLoader. You can access it via FXMLLoader.getDefaultClassLoader().

Platform specific resources

FXLauncher supports filtering of resources for the running platform. Any resource that ends with -[mac|win|linux].jar will only be downloaded and put on the classpath on the corresponding platform. The manifest enforces this though the os attribute in app.xml.

Custom UI

There are two ways to customize the appearance of the update UI. Either you can configure the supported style properties in the manifest, or you can provide a custom implementation of the UIProvider to completely customize the UI. Have a look at this Custom UI Demo Project for more information about customizing the updater.

About

Auto updating launcher for JavaFX Applications

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%