Use exe4j to package Java programs into EXE format

Source: Internet
Author: User

Address: http://blog.csdn.net/fog911811/article/details/6151700

Because of this need, I have previously searched many web pages on the Internet to convert Java programs into executable (exe) programs, but they are not satisfactory. After a while, I found this good thing, exe4j. I personally tried the knife and found it really simple and easy to use. Write it down to make it easy for you to be forgetful:

1. Export the application into a jar file.

1. Package the program into a jar, which is easy to implement in eclipse. Right-click the program and select "Export ".

2. Select "JAR file" and press "Next" to go to the next step.

 

 

3. Select the resources to export is the program I selected by default.

Select the export destination to select the path to save the JAR file. Here I select a new folder named execute file.

Press "save". By default, press "Next" to go to the next step, or press "finish.

 

4. Open the execute file folder, and you can see the file as400tooa. jar that just export into jar.

 

Second, convert the JAR file into an EXE program using exe4j.

1. Open exe4j and click "Next.

 

 

2. Select the second option "jar in EXE" mode and press "Next.

3. Enter a brief description of the application.

Previously, I created a folder named execute file to store related files, so the output directory here selects this folder.

 

2. the executable type here includes the GUI application and console application. I tried the GUI application. Because the effect is not very good, I chose console application.

Executable name must be entered. To clarify the meaning of this program, I should name it importbpcsprogram.

 

 

5. Press the green + button to add the jar package. First, add the as400t0oa. jar package exported in eclipse.

 

6. Then add the jar package required by this program. For example, I want to connect to the database of as400 and the SQL database, so I want to add jt400.jar and msbase. jar, MSSQLServer. jar and other packages.

 

 

7. Add all jar files to be used.

 

8. Select Main class, which will automatically list all main classes. Here, select mainclass. Java I wrote. Click OK to complete the selection.

 

9. For the JRE version of our system, set it to 1.3, and enter 1.6 below. In addition, the configuration program can only be executed on machines with JRE installed, the question to consider during release is whether the user has the ability to install JRE on his/her own machine. Instead of publishing a program, the user must install a JRE on his/her own, next, I will introduce how to dynamically package JDK environment variables into exe. Here, click Advanced
Options: select search sequence.

 

Copy the JRE under my installed Java to the execute file folder, press green +, select directory, and select the JRE root directory (note that it is the copied directory.

 

Click OK, click Advanced options, select preferred Vm, and select client in the pop-up window
Hostspot Vm, click Next to continue:

 

10. The default settings are as follows.

 

11. On this page, the conversion of the EXE program is completed.

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.