How eclipse hits the jar package

Source: Internet
Author: User

1. Prepare the main list file "MANIFEST. MF "

  

manifest-version:1.0 Class-path:lib/commons-codec.jar Lib/commons-httpclient-3.1.jar Lib/commons-logging-1.1.jar Lib/log4j-1.2.16.jar Lib/jackson-all-1.8.5.jar Main-class:com.action.maintest

The first line is the version of Mainifest.
The second line Class-path specifies the location of the foreign jar package
The third line specifies the main Java file that we want to execute.

Here are some points to note
Class-path: And Main-class: There is a space behind, it must be added, otherwise the package fails, error message: Invalid header field;
  Assuming that our project is packaged for Maintest.jar, then as defined above, a Lib folder (i.e. Lib file and packaged jar file in the same directory) should be created in the Maintest.jar directory, and the relevant jar package will be placed inside
  Be sure to enter after you finish Main-class (that is, the last line is a blank line), and let the cursor go to the next line

2. Export the jar file using the Eclipse's export function you need to select the established MANIFEST during the export process. MF file and then fool-type operation

3. You should create a Lib folder (i.e. Lib files and packaged jar files in the same directory) in the same directory as the Maintest.jar, and put the relevant jar packages inside

4.1> Run command under command line Java-jar Maintest.jar

2> Create a new batch file, such as Start.bat, the content is: Java-jar Killcheatfans.jar pause in the jar file in the same directory, and then click to automatically run, more convenient

How eclipse hits the jar package

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.