LANUCH4J generates EXE executables for Java programs

Source: Internet
Author: User
1. StepsCreating a folder (storing the JRE and the exe file to be generated) generates the jar executable lanuch4j the exe file 2. Create a publishing folder

The purpose of creating this folder is to store the JRE and EXE files, and when the EXE file is generated, you can package the file into a zip file directly. When used, unzip and then click on the exe file.

As shown in figure:


Lib holds the JRE. (JRE can be placed anywhere under the Excelmergertool folder)

EXE files are recommended to be placed directly under the publishing folder.

Alternatively, the JRE can be streamlined according to reality.


Objective: To put the JRE and EXE files together for easy management and release. 3. Build jar executable file

This will be accomplished with Eclipse's export capabilities.

Special NOTE: When Java programs rely on Third-party packages, be aware of the type of export.

Suppose the Java program relies on a third party package


Project structure determines which packages and folders to export

Select by clicking Project Properties-java Build Path


The figure above shows which folders will be put into the generated jar file:

only Non-empty folders that are set to Sourcefolder and the source folder are imported.

Such as

Because Lib is not a source folder, it will not be imported into the jar file

Image under Source folder may not be imported, if it is an empty folder.

determine which third-party dependencies to export


All dependent packages shown under libraries are imported into the jar file, except for the JRE.

To build an executable jar file

· Right-click the project file and select Export

· Select runnable JAR file


· determine where the generated jar is located


· Click Finish to generate Runnable jar


4. lanuch4j generated exe file download lanuch4j

http://launch4j.sourceforge.net/ determine exe file generation location


· outputfile specify: Generate EXE file location .

Note: It must be under the Publish folder that you created previously.

· jar: Refers to the runnable jar that has been created above.

Note: If don ' t wrap Thejar below the jar, the launch only checkbox is not selected, the resulting EXE will wrap the jar-specified runnable jar file into an EXE file, which is output The ExcelMergerTool.exe specified in file will contain Excelmergertool.jar files. As a result, Excelmergertool.jar can be deleted when the EXE is successfully generated.

· changedir: Indicates root path

Use . to indicate that the root path is the parent folder where the outputfile specified EXE file resides.

In the above figure its equivalent: E:\temp\source\ExcelMergerTool

This setting is important to set the relative position when the JRE location is set.

such as./lib/jre6 the location of the JRE is: exe under the parent folder under the Lib folder, where the EXE's parent folder is Excelmergertool, so the location of the JRE is:

.../excelmergertool/lib/jre6

Use relative position function:

Regardless of how the publishing folder is located, the EXE can find the JRE based on where it resides (the parent folder as the reference point).

determining the JRE version and the self-location of the JRE


· bundledjre Path: Specify JRE location

As set in the change dir above. The setting that will affect this value.

· Min jreversion: Specify JRE minimum version

The next Drop-down column box sets the JRE access mechanism,

You can access only the custom JRE.

You can: If you are running a PC with a JDK installed and the version is higher, refer to the PC.

and other options

· intialheap size and Max heapsize: setting memory footprint

This can be left blank.

Generate EXE file


Clicking this button will allow you to save a configuration file (XML) that has no effect on the operation of the generated EXE file, so it can be stored in a random location.

Finally, the state of the build is displayed in the log.

5. Packaging and running EXE files

You can compress the publishing folder, such as compressed into a zip format, when you need to use, decompression, double-click to run one of the EXE file.

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.