[difference between jar file and runnable jar file in]eclipse

Source: Internet
Author: User

Java is the most difficult to learn is the corner of the east, is called the Java platform. A search has finally dawned on me.

The method of running the. Class directly is JAVA-CP. Com.network.Chat, do not add. class suffix

The jar file that was export from eclipse simply packs the. Class. Therefore, executing this JAR file requires the use of JAVA-CP. Ch04.jar com.thnkjava.ch04, if you also apply to another Lib library, you must explain in the CP, that is JAVA-CP.; Ch04.jar;lib01.jar;lib02.jar com.thnkjava.ch04 to execute. In fact, it can be found that Ch04.jar is also in the CP, indicating that Ch04.jar is the Lib library, the final parameter indicates the class name to be executed.

If you export the runnable jar file from Eclipse, you do not need to specify which class to execute the jar package, and execute Java-jar Ch04.jar directly. The reason is that the MANIFEST.MF content in the jar package is different. The Runnable jar package indicates which class executes first, so you can use Java-jar Ch04.jar to execute the code you want to execute without having to specify which class. This you can open the jar package to see the difference of MANIFEST.MF, at a glance.

When generating a runnable jar file, there are two options, Extract required libraries into generated jar and package equired libraries into generated jar. The former is to extract the. class file you use, and the latter is to put all the jar packages you need into a package. The MANIFEST.MF file content of the two is also different, this should be caused by eclipse, the IDE did its own thing, specifically do not study.

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

[difference between jar file and runnable jar file in]eclipse

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.