JavaFX local application of its own initiative to update the implementation of the--fxlauncherchszs, without the consent of the blogger may not be reproduced. Permitted reprint should be marked by the Author and blog homepage: Http://blog.csdn.net/chszs, Javapackager Introduction
JavaFX has become one of the best UI frameworks for building modern desktop applications. But it has always been the problem of inconvenient deployment.
The Javapackager tool is a solution to this problem, just as JavaFX has been packaged into JDK 8, and the Javapackager tool is also available with JDK 81.
The Javapackager tool makes it easy to create a local app installer, but unfortunately. Javapackager does not support its own initiative to update.
Java WEB Start can support update operations, but it cannot package local apps.
The Javapackager tool is capable of running packaging and signing tasks for Java applications and JavaFX applications.
语法: javapackager command [options]
Command includes:
1)-CREATEBSS
Convert CSS files into binary form
2)-createjar
Generate jar documents based on other parameters
3)-deploy
Generate the main application advertisement package (can be self-included application advertisement package)
4)-makeall
Run compilation, Createjar and deploy will call it
5)-signjar
Application signature based on the certificate provided
Ii. introduction of Fxlauncher
The Fxlauncher tool combines the Javapackager local installer feature with the Java WEB start similar update mechanism. Enables the ability to use Fxlauncher without having to install packages locally, and to advertise only 14KB of runnable jar files (launcher). Download the individual modules of your app and keep the app's version number updated by using the online installation method.
Launcher the contents of the application's manifest file (App.xml), and the manifest file is used to synchronize the local artifact at startup.
When the manifest is loaded. Users will see this animation:
When the application starts updating, the user sees this animation:
The preloader then controls the application process. Launcher appears to be configured using CSS.
Sample of the contents of the manifest file (app.xml):
<Application uri="http://fxldemo.tornado.no/" launch="no.tornado.FxlDemo"> <lib file="controlsfx.jar" checksum="1589854040" size="954085"/> <lib file="fxldemo-2.0.jar" checksum="223197943" size="4865"/> <updateText>Updating...</updateText> <updateLabelStyle>-fx-font-weight: bold;</updateLabelStyle> <progressBarStyle>-fx-pref-width: 200;</progressBarStyle> <wrapperStyle>-fx-spacing: 10; -fx-padding: 25;</wrapperStyle></Application>
The local installer does not include any code, so there is no need to rebuild the application when it publishes the new version number, simply by copying the application's artifact to the pre-defined location. Fxlauncher will take care of all the rest of the work.
Fxlauncher is also able to handle applications in a variety of programming languages, and it works well with TORNADOFX.
Examples of combinations of fxlauncher and tornado see: http://fxldemo.tornado.no/
Third, the use of fxlauncher steps
1) Compile the project jar to App.dir
2) Copy dependency package to App.dir
3) Generate App.xml Manifest
4) Create a local installer
5) upload artifact to your own initiative to update the warehouse
Copy the deployment descriptive descriptor. and make changes according to your needs:
<properties> <!-- 应用程序名 --> <app.filename>${project.name}</app.filename> <!-- JavaFX应用的入口类 --> <app.mainClass>no.tornado.FxlDemo</app.mainClass> <!-- app和launcher存放位置 --> <app.dir>${project.build.directory}/app</app.dir> <!-- 本地安装器存放位置 --> <app.installerdir>${project.build.directory}/installer</app.installerdir> <!-- 托管应用artifact的基础URL --> <app.url>http://fxsamples.tornado.no/demo/</app.url> <!-- Optional scp target for application artifacts hosted at the above url --> <app.deploy.target>[email protected]:fxldemo</app.deploy.target></properties>
Iv. maven Goals
1. Generate the Application
mvn clean package
2. Deploy the application artifact to your own webserver
mvn exec:[email protected]
3. Setting up local installers
mvn exec:[email protected]
V. Introduction of TORNADOFX
TORNADOFX is a lightweight JavaFX framework for Kotlin languages. Features of the TORNADOFX include:
1) Dependency Injection
2) Type safety builder
3) Asynchronous task run
4) MVC
5) Extremely lightweight
6) Small and simple API
7) Restclient provided for model objects
8) 0 configuration, no XML required, no staring
Https://github.com/edvin/tornadofx
Tornado's maven dependency:
<dependency> <groupId>no.tornado</groupId> <artifactId>fx</artifactId> <version>1.2.3</version></dependency>
JavaFX natively applies its own proactive Update feature implementation Fxlauncher