How to generate an executable jar file with the jar command

Source: Internet
Author: User

If you have generated a Zh.class file with the Zh.java file

If the path to Zh.class is Bin/com/zhang/zh.class

A MANIFEST.MF file is placed in the bin directory with the following file contents:

manifest-version:1.0 Created-by:1.5.0_06 (Sun Microsystems Inc.) Main-class:com.zhang.zh

Note that the Main-class heel must be the full path to the class that contains the main method.

Then use the command to go to the bin directory to execute the jar CVMF zh.jar MANIFEST.MF *

You will get Zh.jar in the bin directory

Take a look at Java-jar Zh.jar.

How to generate an executable jar file with the jar command

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.