Exe4j package jar into EXE file (package JDK)

Source: Internet
Author: User

Use myeclipse-> export to generate the. Class file, and then use the exe4j packaging tool to select the exported. Class file.

There have been examples of packaging with exe4j before, according to the previous blog document http://blog.csdn.net/tming_1985/archive/2009/12/24/5070540.aspx can be packaged successfully.

The exe4j version I used is 4.1, which can be downloaded at http://download.csdn.net/source/2379276.

However, the user will always delete the Java environment installed on his machine, and the client will never be used. So we need to package JDK to the client.Program. Although the file is large, it can be run in an environment where JDK is not loaded. The following two examples can be used to package JDK into a client on a machine that does not have a Java environment.

Figure 1 JDK not packaged

Figure 2 JDK not packaged

Content text is also reproduced by the http://hi.baidu.com/%D3%AD%B7%E7%BB%AF%D3%EA/blog/item/bc6241de5f4a5e5dcdbf1a5e.html author for the wind rain

First, you have the available jar files and exe4j programs by default.
The detailed steps are as follows:
1. Welcome-open exe4j

If you have saved the project packaging configuration file, click> open. If there is no point> next.
2. Project type-select the packaging method

Because we are talking about packaging jar to generate EXE, we select "jar in EXE" mode. In this way, we can package a Java application into an EXE file, however, you cannot package additional files except jar files. Then> next

3. Application Info-configure the information of the generated Application


Set the name of your application and the output folder of the executable file to be generated. Then> next.
4. executable Info-configure the parameters of the executable file

Type is determined based on the type of your program. In this example, it is a GUI program; next is the file name, the executable file icon, whether to allow only one application to run at the same time, when the main thread has a mistake
Whether to throw an exception or change the working directory (relative to the executable file ). Click> advanced options> version info.
5. version info-set version information

6. Java invocation-configure the runtime environment

First configure the class path, delete all the original configurations in this item, and click "+" to find the JAR file you generated,

Then click the Browse button in the general section above. exe4j will automatically find the main class entry for your application.
At the bottom of the Advanced
Select native in Options
Libraries settings, this function is to add external jar package files used by your program, I have never used this, because I like to concentrate on everything, therefore, all external packages used in the program are fully integrated.
It's in JDK/JRE, so that when you install a program for the customer, you just need to test the program for him and then you can use it. You don't need to install other things, and they will like it very much, after all, users are not engaged in programming.
Well.
7. JRE-configure JRE

Configure your JRE version type here, and then see> advanced option> search sequence

Here, you can configure the location of the JRE/JDK required to run the program. If you only run the program on the local machine after packaging, you can directly specify the JRE/JDK directory on your local machine, if your packaged program wants
Run on another client, and the machine does not have JDK installed, then we have to think of another method. From the customer's point of view, the software should be installed as little as possible to bring tedious installation to the customer.
Item, it is best to just click the mouse to automatically install. Therefore, we need to save the trouble of installing JDK. To solve this problem, we can place the installed JDK copy under the root directory of the final product,
Add this JDK copy to the running environment of the program.

Search registty can scan installed JDK/JRE. We select directory to specify a JDK directory for the program. You only need to locate the JDK root directory, as shown in. Then> next
It should be noted that only one JRE is required for the program developed with eclipse, and JDK is not needed. Therefore, I package JRE into the EXE runtime environment, in this case, the option under Java version that allows the use of JRE beta version will be selected.
8. Preferred VM-select Virtual Machine

This is selected based on the actual situation. This example is client. Then> next
9. Splash Screen-preload form

You can set your preload form interface here, but it seems that you only recognize GIF images, status line and version line.
In position text lines
Adjust the display position on the visually preview page. Next, select the language interface and select the language based on your needs. Then> next
10. Compile executable-compile and generate an executable file

Automatically jump:

Here, you can click the executable file generated by running or save the configuration scheme for future use.

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.