Install4j package jar

Source: Internet
Author: User

With the help of install4j software, I have finally learned how to package Java programs (jar) into installable Windows applications.

The related software can be found at http://download.csdn.net /.

 

Process records are as follows:

1. generate an executable JAR file in various ways (see http://blog.sina.com.cn/s/blog_65bb33240100ii4r.html)

2. generate a new jrebundled file with the suffix tar.gz.

3. Package Java programs through install4j

Next, record Step 2 and step 3.

Reference

Http://download.csdn.net/source/2304884

Http://download.csdn.net/source/2303298

 

Step 2:

  1. Run install4j, select create a JRE bundle under the project menu, and click Next in the generate wizard dialog box to enter the select JRE dialog box, select the Browse button (rightmost In the first row ).
  2. Select the folder dialog box, select the directory for which you want to generate the bundle file (that is, the tar.gz file), and click the OPEN button
  3. Enter your JRE version, such as 1.5
  4. Enter the file name of the bundle. Enter either of them, preferably an English character (in Chinese, it is hard to distinguish between them. Hi. You cannot find any Chinese support)
  5. Click Next and you will see no. It will help you generate the bundled file. If your JRE is not streamlined, it will take a few minutes (depending on your computer configuration)
  6. After the file is successfully generated, the wizard displays the physical path for saving the generated file (if there are no special requirements, we recommend that you do not move the bound file)
  7. Success

 

 

Step 3:

Package A Java program using install4j with a total of six parts (corresponding to the six icons in the left navigation): General settings (general configuration information), files (files to be packaged ), launchers, installer, media, and build)

 

Part 1: collect relevant information

1. Run install4j and select "new project" under the project menu)

Enter the full name fullname of the software, the short name for short, the version information of the software, the publisher of the software, and the release URL (it is best to save your generated information file for future use, it is a file suffixed with install4j)

2. Click the blue arrow in the upper-right corner to go to the next step. You must enter 1.5 for the smallest JRE version (usually the same as the JRE version of the bound file ).

3. Delete the default three items in the JRE search sequence (where to find the JVM for your Java application) group. Click "+" on the right to add a search option.

4. in the displayed dialog box, enter the name of your bundled folder. Generally, enter JRE (must match the name of the bundled folder ), click OK. The bound folder you entered is displayed in the group. click Next.

5. Select the language of the installer, and click the drop-down button to select the top Simplified Chinese language option.

6. Next, select the storage path for the installation program you want to generate (I created a Temporary Folder temp on disk D)

7. In the compression (compression) group, select use lzma compression (.....) Check button (high compression rate, not very slow !)

8. Next, go to the next step.Part 1

 

Part 1:

1. click Add files to bring up the Add folder or folder dialog box, here you can choose whether to add a single file or a folder (usually put all the files you want to package in a temporary folder) and click Next.

2. Click the Browse button to bring up the select folder dialog box, select the folder where the file to be packaged is located (I still put it in the temp folder), click open, and return to the original wizard.

3. click "Next" and then click "Next". You can select the "If create, but not for update" radio button (which probably means you will ask before detaching) and click "Next, select the file or folder to be excluded (not generated) If **. select this check box for install4j (this is the information file generated ).

4. click "Next" until the Wizard is completed. Click "OK" to return to section 2nd. The selected Directory D:/temp appears under the installation directory, and click "Next" (the arrow in the upper right corner)

5. The installable files and folders in the directory are displayed. Click Next and click Next,Go to Part 1

 

Part 1:

1. Double-click the rocket launcher icon (new launcher), and a wizard pops up (this wizard is quite a lot). Click the next button (the key part starts)

2. enter the name of your application in executable name (it is the name of the image that your Java program shows in Task Manager), and enter a name in directory. (or you can click browse, select the installation directory, and click OK. The results are the same) and click Next.

3. if you want to set your own application icon, check the Add icon to launcher check button, and then click the Browse button to select two pictures in PNG format that you like (I have not tried other formats, you can try ). Otherwise, click the next button.

4. go to Java Invocation (Java does not know why such a name is used). First, click the green + sign (add class) in the class path group. A select path dialog box is displayed, (select the archive (archive file) radio button in the type group ), click the Browse button to select the JAR file or class file you want to add (I first package all the class files into executable jar files, but you can try to add the class file without packaging) After selecting, click OK to return to the wizard, and then select main in the general group
Class file (this file is your Java program entry class file, is the class file where the program's first main method runs), next button

5. the program waits for the screen to be set. If you do not want to set the startup screen of the program, you can directly click Next (I skipped it directly, but you can try it), and then click Next until it is complete, click OK to return to step 2.

6.Now there are two rocket launchers (yes, one of them is yours). click Next.Go to Part 1

 

Part 1:

1. I haven't studied much here. It is probably about setting some attributes of the installer (I will study it later. If you have any research achievements or progress, please remember to tell me in time and learn from each other) next .... Or directly click the mide icon on the left to jumpPart 1

 

Part 1:

1. Double-click the new media file icon and a wizard is displayed. Hi ..

2. in the installation type drop-down box, select the Windows option and click Next. Click use custom installlation base directory and enter D: /After the installation program is run, the default installation path is in the javaclock (software abbreviation) folder on drive D, and then press the next button four times

3. bundled JRE (this is also a very important step. I have failed several times here !), Select bundle the following JRE: Single-choice button, and click the following choose one to bring up a drop-down box. If your bundle file is successfully generated, A window x 86 + Your bundled file name option will appear. That's right. Click it! Next

4. click the choose a customeization category button and select the 5th items that pop up. Here you can view the files or folders you want to exclude. If there are still files or folders you do not want to package, check it.

5. Click Next several times, and then click OK. It is obvious that the next step is back. The next step is the next step. Congratulations!Coming to the end

 

Step 2:

1. it is strongly recommended that you test your generation (click the test build button) first. If there is an error, the corresponding error message (in red) will be prompted or jump to the location to be corrected. Correct the error (save it) and test it again until there is no red font. Congratulations, your installation package is complete.

2. Click the start build button to see that the build progress is not complete. After it is complete, you can install and run your Java program on a machine without JVM installed.

3. ClickD:/temp/You can directly open the folder where your installation program is located. Next, test your DIY installation program on a machine without JVM.

 

After that:

I directly package the entire JRE without streamlining the JRE. The generated program is only 17.6 MB. My JRE version 1.6 has a size of 86.3 MB and the generated bundle file has a size of 16.4 MB. The total size of the resource file plus the JAR file is 1.1 kb. In this case, the installer will occupy about mb. Therefore, go to the Internet to find the lite version of JRE, only by keeping JRE down is Java's personal program web distribution realistic.

 

Do not hesitate to contact me in the following situations:

 

1. You have good JRE weight loss methods

2. You have a good suggestion or an error in this article.

3. You have better or other research on Java program packaging through istall4j

4. You have better or other solutions for Java packaging and distribution.

5. You will not package Java programs through this article

 

My contact information:

 

QQ: 1323748874

Gmail: thoamstang@gmail.com

Blog: http://blog.sina.com.cn/tangweixin2010

 

 

 

 

We sincerely hope that every programmer program will get better and better written, and the technology will get higher and higher, and his life will get better and better!

 

 

Thomas

 

Download all the process diagrams shown in the following figure.

Http://download.csdn.net/source/2304884

Http://download.csdn.net/source/2303298

 

Reprinted: http://blog.csdn.net/thomastang2012/article/details/5694816

 

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.