Convert the Jar file to the exe installation file, and install the jar file.

Source: Internet
Author: User

Convert the Jar file to the exe installation file, and install the jar file.

After checking on the network and using the exe4jtool for real-time conversion, the basic steps of the software are as follows:

1. you need to know whether the target file is 32-bit or 64-bit. If the generated file is 32-bit, you need to use a 32-bit jre. If the generated file is 64-bit, A 64-bit jre is required.

Figure 1

Select 32bit or 64bit in the circle. Because I want to create 32bit, the default value is used.

2. JRE configuration (if not configured, various JAVA_HOME errors will be reported ):

The hosts file is also in this directory.

Figure 2

Click search Sequence of the sixth JRE in Figure 1. The page is displayed:

Figure 3

Delete these three items, and then re-select the jre directory, and specify the directory as the jre folder in the "HJ helper 1.1" folder.

Figure 4

In this example, the .exe executable file can be executed without the error shown in. You can also send the "HJ assistant 1.1" folder to your computer without jre installed.

3.The. EXE file behind the conversion cannot display image resources.

My project is a Swing project, which requires some icons. Because it is the .exe execution file, the class loader is used to read image resources, rather than the URL address.

ImageIcon icon = new ImageIcon(ImageIO.read(getClass().getClassLoader().                    getResource("frame.png")));

Another important point is that the folder for storing images must be a system resource folder. Otherwise, the image cannot be obtained and the folder is set as a resource folder.

4. even though a runtime. EXE file has been generated, the jre folder should also be put together when it is used by others, so the folder size seems to have reached more than 100 MB, but your original file is actually very small, therefore, I use the Inno Setup packaging tool to package the folder into an installation file, which reduces the occupied capacity. The Inno Setup tool is easy to use and can be downloaded to the Chinese version on the network. Here is a note during the packaging process:

: When adding a folder, you need to add the top-level directory of the jre folder. In this project, it is the "HJ helper 1.1" folder. Otherwise, the jre file cannot be found during running.

The installation file of the. exe can be produced quickly, with a size of over 30 mb, much smaller than the original folder.

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.