Package Java project as executable (EXE)

Source: Internet
Author: User

has been writing Java programs after the console Javac--and Java commands run, or run in eclipse, today suddenly want to how can write a project anywhere can run it? So the online search steps, followed by a step-by-step realization, here to record

Tools: Eclipse

Exe4j

1. First use the features provided by Eclipse to package the project into a jar package

1) Right-click on the item you want to package

2) Select Export

3) Java--Runnable JAR file----and Next

4) in export destination: Select the path you want

Select package required libraries into generated JAR-->finish

Here: A jar package can be run, but if you want to run it or you need to go through the console output command

Java-jar Lucky_day.jar//Lucky_day The name of the packaged jar file

Note: The project here needs to be run first.

2. Use EXE4J to package the packaged jar file into an EXE file that can be executed by mouse click

1) Run exe4j--and Next

2) JAR in EXE mode----Next

3) Short name of your application: a packaged EXE file named

Output directory: To package EXE files there---> Next

4) If it is console select Console Spplication depending on the situation

Executable name: executable exe file names

You can also select the last EXE file icon

--Next

5) Click on the small green dots on the right side of the Class path to add the jar files that need to be packaged

Entry Type Select Archive

Main class Select Good

Next

6) Fill in the highest and lowest version of the JRE

Select Search sequence to delete all of the items and copy the installed JRE directory to the directory where the JRE (the copied directory) will be added under the path to be packaged (in order to run the program on a computer that does not have a JRE installed)

7) Client hotspot VM

Right behind, next to the end.

Let's see for a moment

Package Java project as executable (EXE)

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.