[Original] Use install4j to create a Windows installation package for javafx2.x [previous]

Source: Internet
Author: User

Recently, due to project requirements, I need to create a Windows installation package for myself using the desktop software smarthome developed by javafx2.1. Because the process is quite complicated, I will record it for future reference.

 

I. Production Tools

1. fatjar: Eclipse plug-in, its plug-in update URL: http://kurucz-grafika.de/fatjar

2. install4j: a use of eclipse RCP development of the charges for the Java program to create the installation package of the software, provide a 90-day trial, official download URL: http://www.ej-technologies.com/products/install4j/overview.html

3. JRE: what is needed is jdk7u6: http://jdk7.java.net/download.html. This is the latest JRE (as of) because it has included javafx2.2

Web site (Open Source China): http://www.oschina.net/news/30075/javafx-2-2

It is true that the JDK provides two tools for packaging javafx applications. One is to use javafxpackager, the other is to use ant, I personally feel that both methods are not easy to use. It is very troublesome... bytes

Help documentation on the official website:

Native packaging for javafx: https://blogs.oracle.com/talkingjavadeployment/entry/native_packaging_for_javafx

Deploying javafx applications: http://docs.oracle.com/javafx/2/deployment/jfxpub-deployment.htm

 

The main content of this tutorial is to use the above tool javafx application to create a Windows Installation Package

 

Ii. Procedure

1. install jdk7u6. During installation, I specify that JRE is installed in the same directory as JDK. The folder name is jre7u6, And the directory after installation is D: \ Java \ jdk1.7.0 _ 06 the corresponding JRE directory is D: \ Java \ jre7u6

Replace the Java environment of the smarthome project with the JDK installed just now. There are many methods. I am used to creating user Libarary, named jre7u6-javafx2.2 (named casually)

Delete the previously split JRE and javafx RT, and add this JRE!

2. Install farjar. Install the Eclipse plug-in online. After installation is complete, restart eclipse. Click the project, select build fat jar, and configure some basic information, such as mainclass and classpath.

On the second page, select the third-party jar package required by the project.

3. the jar package smarthome0.0.7 _ fat is obtained in the first two steps. jar, in the root directory of the project, and then create a folder named smarthome to store the content required for creating the installation package. The general content is actually a few:

(1) smarthome0.0.7 _ fat. Jar

(2) software image resources, such as logo icons and splash images.

(3) third-party jar packages, because the above fatjar has already packaged the required third-party jar, so you can skip this process ......

4. after installing install4j, I downloaded the trial version and only tried it for 90 days, but it was enough for me to use it. However, some annoying tips may be prompted for the software I got from the trial version, if you don't like it, go to the cracked version or buy it!

After installation, create a new project named smarthome and save it wherever it is. Here I still save it to the smarthome directory, because the install4j software often needs to add files or folders.

By default, it enters the directory where the project is located.

5. Next is the most critical step: Create a JRE bundle to prepare for the subsequent media file creation.

The reason is that the latest jdk7u6 is not available on the server of install4j, and the client generally does not have the Java environment installed. Even if there is, it is impossible to be the latest jre7u6, to bind the software to this specific JRE!

To bind this specific JRE, you must first create a JRE bundle, and then select this JRE bundle in the media file configuration.

For details, see the help document jrebundle.html in the installation directory of install4j, which is well written and detailed.

In the main menu of install4j, select project-> Create a JRE bundle to start production.

In select the JRE, select the jre7u6 directory installed in step 1.

In the output directory, the export path of the generated JRE bundle file is specified, which is placed in the jres folder under the installation directory of install4j by default, because I have already created the file once,

Therefore, this JRE bundle already exists in the jres directory, so I will re-export it to the previously created smarthome directory, I found through a production error that the search path actually contains the root directory of the current install4j project!

But it is not mentioned in the help document!

In the help document media file Wizard: bundled JRE, the find path of the JRE bundle file is$ Install4j_home/jresAnd{User home directory}/. install4j5/jres

"If you choose to bundle a JRE by selecting"Bundle the following JRE"Radio button, you have to choose a JRE from the drop down list below it. if you select "Manual entry" in the drop down list, a text field will appear where you can enter a file name with compiler variables. please note that you cannot enter a path here, but only a bundle filename that will be searched in$Install4j_home/jresAnd{User home directory}/. install4j5/jres. The existence of this bundle file will be checked only at compile time, not by the Wizard ."

The bundle file name is used to specify the name of the budle file and the Java version and custom ID. If this parameter is not specified, install4j can detect

Other steps by default, and finally generate bundle windows-x86-1.7.0.6_jre7u6-javafx2.2.tar.gz is a compressed file, as to why is Linux common compressed file I do not know, software developers like? Not necessarily...

The name of the generated budle file {platform}-{Java version}-{custom ID} can be specified by the next two, if you do not specify to use the default, then the generated bundle file is a windows-x86-1.7.0_06-ea.tar.gz

6. Start creating the installation package! I will only introduce the steps I need to configure, but will not describe the specific use of install4j in detail!

Reference URL:

Install4j User Guide: http://wenku.baidu.com/view/f8abc62ded630b1c59eeb544.html ###

Package EXE for Java with install4j Tutorial: http://wenku.baidu.com/view/d0fb8e0716fc700abb68fcc2.html ###

By install4j: http://wenku.baidu.com/view/20f86306bed5b9f3f90f1ced.html ###

 

(1) General setting

Set the full name, short name, and version information of the software in application info.

In Java version, set the minimum version number to 1.7 and delete all items in the JRE search sequence. This is not a common configuration method, because it is not common to package javafx! Its JRE must be followed by the installation package!

This is generally the case. Select the appropriate JRE that meets the maximum and minimum conditions in the search order to run the program. Here we do not need to search, but bind the JRE we have prepared earlier!

Select the first entry in the language: Simplified Chinese

In Media File Options, set the storage path of the generated Installation File. For convenience, I saved it to the smarthome folder. The file name is generated using the default pattern.

Keep the default values for other parts.

 

 

(2) files

In the define distribution tree, click installation directory, select Add file or folder, and select the jar package exported using fatjar And the logo image of the software. By default, you can

Final result: a jar and an image

 

(3) Launchers

Create a new launch and select generated launcher.

In executable info, set the name of the Startup Program EXE file: smarthome. If only one instance is allowed to run, select allow only a single running instance of the application

Set the software Icon In the icon and select the imported logo

Import the jar package in the class path of Java invocation and specify the main class

Keep the default values for other parts.

 

(4) Installer

Keep all by default

 

(5) Media

Create a media file, select installer, and set the type to Windows.

In configure installer options, set the name of the folder installed on the client. The default value is shortname. I changed it to the value of the fullname variable during compilation.

Focus on bundle JRE (binding JRE), select bundle the following JRE, and select manual entry, enter the file name windows-x86-1.7.0.6_jre7u6-javafx2.2 of the JRE bundle created earlier in the text box that follows

Note: The file does not contain .tar.gz. Note that the file is in the smarthome directory and can be found! For more information, see the previous production introduction!

 

(6) Build

Click Start build. An error is returned. You must set a JRE search path in application info. Because the JRE is statically bound, select the environment variable SYS. withjre.

It indicates that if JRE is statically bound to media file, this variable is a variable containing "_ with_jre", otherwise it is a null string.

 

After the configuration is complete, start build again. The final result is:

 

 

Iii. Installation Process

Double-click the generated smarthome_windows_00000_0.exe. Because the trial version of install4j is used, a prompt window is displayed. OK.

Then go to the Installation Wizard:

(1)

(2)

(3)

(4)

(5)

(6)

 

Now that the installation is complete, you can see the Start menu and click Run. At the beginning, there will also be a prompt for install4j. OK.

 

Logon interface:

 

Main Interface:

 

This is the end! O (partition _ tables) O hahaha ~ Enjoy the world of javafx!

Related Article

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.