Differences between JAR file and runnable JAR file in eclipse

Source: Internet
Author: User

Java is the most difficult to learn. It is called Java platform. After searching, I finally understood it.

Directly run the. Class Method Java-CP. com. Network. Chat without adding the. Class suffix

From the JAR file of Export in eclipse, only. Class is packaged. Therefore, Java-CP .; ch04.jar COM. thnkjava. ch04. If you still apply it to another lib library, you must describe it in CP, that is, Java-CP .; ch04.jar; lib01.jar; lib02.jar COM. thnkjava. ch04. In fact, it can be found that ch04.jar is also in CP, indicating that ch04.jar is the Lib library, and the final parameter specifies the class name to be executed.

If runnable JAR file is export from eclipse, you do not need to specify the class when executing this jar package. You can directly execute Java-jar ch04.jar in this way. The reason is that the manifest. MF content in the jar package is different. The runnable jar package specifies the class to be executed first, so you can use Java-jar ch04.jar to executeCodeWithout specifying the specific class. You can open the jar package to view the differences between manifest. MF.

When generating runnable JAR file, there are two options: extract required libraries into generated jar and package equired libraries into generated jar. The former extracts the. Class file you use, and the latter extracts all the jar packages you need into a package. The content of the manifest. MF file is different between the two. This should be caused by eclipse. Ide does its own thing and will not study it in detail.

Http://download.oracle.com/javase/tutorial/deployment/jar/appman.html

 

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.