Coder Social home page Coder Social logo

fxlauncher's Introduction

FXLauncher

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. The example uses Maven, but the launcher is not maven specific in any way.

There is also a QuickStart Project with a pom.xml that describes the steps involved.

Video demonstration

See the launcher in action in this short screencast.

How does it work?

FXLauncher is a 14Kb 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

Have a look at the pom.xml from the QuickStart Project.

The following steps are involved:

  • Compile project jar to app.dir
  • Copy dependencies to app.dir
  • Generate app.xml manifest and embed it into the launcher
  • Create native installer
  • Upload artifacts to auto update repository

All you need to do is configure the project spesific configuration properties:

<properties>
	<!-- Installer Filename without suffix -->
	<app.filename>FxlDemo</app.filename>

	<!-- The JavaFX Application class name -->
	<app.mainClass>no.tornado.FxlDemo</app.mainClass>

	<!-- The Application vendor used by javapackager -->
	<app.vendor>Acme Inc</app.vendor>

	<!-- The Application version used by javapackager -->
	<app.version>2.0</app.version>

	<!-- Base URL where you will host the application artifacts -->
	<app.url>http://fxldemo.tornado.no/</app.url>

	<!-- Optional scp target for application artifacts hosted at the above url -->
	<app.deploy.target>[email protected]:fxldemo</app.deploy.target>

	<!-- The app and launcher will be assembled in this folder -->
	<app.dir>${project.build.directory}/app</app.dir>

	<!-- Native installers will be built in this folder -->
	<app.installerdir>${project.build.directory}/installer</app.installerdir>
</properties>

Maven targets

Generate the application

mvn clean package

Deploy the application artifacts to your webserver

mvn exec:exec@deploy-app

Build a native installer

mvn exec:exec@installer

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

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().

fxlauncher's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.