The implementation method of converting jar file into EXE installation file _java

Source: Internet
Author: User

1. You want to clear the target file is 32 bits or 64 bits, if the generation is 32, you will use the 32-bit JRE, if the generation is 64, you will use the 64-bit JRE.

Figure 1

Select 32bit or 64bit in the circle position. Because I want to create a 32bit, I use the default.

2.JRE configuration (not configured to report various Java_home errors):

I first create a folder called "Hj Little Helper", and then put my executable program Limitvic1.1.jar and JRE folder in, the later generated. exe files are also placed in this directory.

Figure 2

Click on the sixth JRE search Sequence in Figure one, and there will be an interface as shown in the figure:

Figure Three

Delete all three items, and then select the JRE directory, specifying the JRE folder in the HJ Small Assistant 1.1 folder. As shown in figure:

Figure Four

This way the EXE executable file can be executed, do not report the error shown in the following figure, the "HJ Small Assistant 1.1" folder to the computer without the JRE installed by the small partners can also use.

3. The converted. exe file cannot display the picture resource.

My project is a swing project where you need to use some icons. Because it is an. exe execution file, the class loader is needed to read the picture resource, not the URL address directly.

ImageIcon icon = new ImageIcon (Imageio.read (GetClass (). getClassLoader          

(). GetResource ("Frame.png"));

Another important point is that the picture folder must be a System resource folder, otherwise the picture can not get, as shown in the folder as a resource folder.

4. Now that you have generated a running. exe file, but for others to use when the JRE folder will also be put in, such as folder size seems to reach more than 100 trillion, but your original file is actually very small, so I use Inno Setup packaging tools, the folder into an installation file, This takes up a lot of capacity. The Inno Setup tool is also very simple to use, and the network can be downloaded to the Chinese version of the. Here's a mention of one of the issues that should be noticed in the packaging process:

As shown in the picture: When adding a folder, add the top level directory of the JRE folder to the "HJ Little Helper 1.1" folder in this project, otherwise the JRE file cannot be found when running.

Depending on the Script wizard steps you will soon be able to produce an. exe installation file, which is more than 30 megabytes in size, much smaller than the original folder.

The above is a small set for everyone to bring the jar file into the EXE installation file implementation method of all content, I hope that we support cloud Habitat Community ~

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.