How to make Java Project a jar package--with external jar packages

Source: Internet
Author: User

Personal Home page has been migrated to: http://www.blog4app.com

1. Use Eclipse's export. Generates a jar package that specifies the class of the program's entry.

2, because the use of export will not be outside the jar pack, packaged together. So the following actions are needed:

1 For example, create a new folder under/root/test

2 to the 1 generated jar package, copy to the test directory

3 Create a new Lib folder in the test directory

4 Copy all the jar packages used in the project to the Lib directory

5 Open 1 generated jar packages with WinRAR and modify the MANIFEST.MF file below the Meta-inf directory.

Changes to note a few (1) main-class, Class-path Colon after a space (2) Class-path return to the front to have two spaces

To post the MANIFEST.MF I used:

manifest-version:1.0 Main-class:com.socket.server.simplehttpserver Class-path:lib/commons-beanutils-1.8.0.jar Lib/commons-codec-1.3.jar Lib/commons-io-1.4.jar Lib/commons-logging-1.1.1.jar Lib/httpclient-4.0.jar lib/ Httpcore-4.0.1.jar Lib/jcouchdb-1.0.1-1.jar Lib/log4j-1.2.14.jar Lib/slf4j-api-1.6.1.jar Lib/svenson-1.3.8.jar lib/ Slf4j-log4j12-1.6.1.jar  

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.