Implementation of the automatic update function of JavaFX local application FXLauncher

Source: Internet
Author: User

Implementation of the automatic update function of JavaFX local application FXLauncher
Implementation of the automatic update function of JavaFX Local Application -- FXLauncher 1. Introduction to Javapackager

JavaFX has become one of the best UI frameworks for building modern desktop applications, but it is always inconvenient to deploy. The Javapackager tool is a solution to this problem. Just as JavaFX has been packaged into JDK 8, The Javapackager tool is also provided along with JDK 8.
The Javapackager tool makes it easy to create an installer for a local application. Unfortunately, Javapackager does not support automatic updates. Java Web Start supports update operations, but it cannot package local applications.
The Javapackager tool can be used to package and sign Java applications and JavaFX applications.

Syntax: javapackager command [options]

Command includes:
1)-createbss
Convert the CSS file to a binary format
2)-createjar
Generate JAR files based on other parameters
3)-deploy
Generate basic application release packages (can be self-contained application release packages)
4)-makeall
Run the compilation. Both createjar and deploy call it.
5)-signjar
Sign the application based on the provided Certificate

II. Introduction to FXLauncher

The FXLauncher tool combines the local installer function of Javapackager with an update mechanism similar to Java Web Start, so that you can use FXLauncher without the need for local installation packages, and release a 14 KB executable JAR file (launcher), download each module of the application through online installation, and keep the application version updated.

Launcher first checks the content of the manifest file (app. xml) of the application. The manifest file is used to synchronize local artifact at startup.
When Manifest is loaded, you will see an animation like this:

When the application starts to update, you will see an animation like this:

The preloader then controls the application process. Launcher looks like it is configured with CSS.

Content example of the manifest file (app. xml:

    
      
       
    
     Updating...
        
    
     -fx-font-weight: bold;
        
    
     -fx-pref-width: 200;
        
    
     -fx-spacing: 10; -fx-padding: 25;
    
   
  

The local installer does not contain any code, so you do not need to rebuild the new versions when the application is released. You only need to simply copy the artifact of the application to the predefined location, FXLauncher handles all the remaining work.

FXLauncher can also handle applications in multiple programming languages. It works very well with TornadoFX.
For examples of combining FXLauncher and Tornado, see: http://fxldemo.tornado.no/

Iii. Procedure for using FXLauncher

1) compile the project JAR to app. dir
2) copy the dependency package to app. dir.
3) generate app. xml manifest
4) create a local Installer
5) Upload artifact to the automatic update repository.

Copy the deployment descriptor and modify it as needed:


      
   $ {Project. name}    
   No. tornado. FxlDemo    
   $ {Project. build. directory}/app    
   $ {Project. build. directory}/installer    
   Http://fxsamples.tornado.no/demo/    
   [Email protected]: fxldemo
  
Iv. Maven Objectives

1. Generate applications

mvn clean package

2. Deploy the application artifact to your Web server

mvn exec:exec@deploy-app

3. Create a local Installer

mvn exec:exec@installer
V. Introduction to TornadoFX

TornadoFX is a lightweight JavaFX framework for the Kotlin language. TornadoFX has the following features:
1) Dependency Injection
2) type security validator
3) asynchronous task execution
4) MVC
5) extremely lightweight
6) small and simple API
7) REST clients provided for Model Objects
8) Zero Configuration, no XML, no comments required

Https://github.com/edvin/tornadofx

Tornado Maven dependency:


      
   
    no.tornado
       fx    
   
    1.2.3
   
  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.