The Java project in eclipse is exported as a jar file that can be run directly by double-clicking

Source: Internet
Author: User

1. Select the project to which you want to place the jar files, right-click the "Export" button

2. Select "java-->runnable JAR file" and click "Next";

3. In the drop-down list under "Launch Configuration", select the main class to run when the program starts;

In the "Export destination" under the "Browse" button to select the storage path of the jar, and enter the jar file name;

If the program relies on other packages, select "Package required libraries into generated JAR" or "Copy required libraries into a sub-fol" at "Library handling" Der next to the generated JAR ", if you choose the latter, when you export, you will copy the required package to a directory, and when you refer to the jar package, it must be copied to the same directory as the jar package.

4. The interpretation of the handling part of the library is as follows:

(1) Extract required libraries into generated JAR. Remove all import jars and include them in each directory of the jar, ex. net/org/xxx.class

(2) Package required libraries into generated JAR. Wrap all the import jars in the root directory of the jar

(3) Copy required libraries into a sub-folder next to the generated JAR. Place all the import jars in a separate folder outside the jar

The Java project in eclipse is exported as a jar file that can be run directly by double-clicking

Related Article

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.