How to play jar bag learning notes

Source: Internet
Author: User

The jar package is compressed by a. class file. To view the contents of the jar package, unzip it using the compression tool. You can also make changes and re-play the jar package. Take a look at some of the ways you've learned to hit jar packs recently:

One, DOS use JAR command to hit the jar package

(1) Under DOS input command: ">jar", you can see its usage, such as:

  

(2) Here are some common examples of the file directory structure used in the example

  

Example 1: Package 1.class and 2.class into Test.jar by:

  

Results: The Test.jar,jar package directory structure under Jar-example will be added as follows:

Test

|----Meta-inf

|----Manifesat. Mf

|----1.class

|----2.class

Example 2: Hit all files under the HR folder into Test3.jar, by:

  

Results: The Test3.jar,jar package directory structure under Jar-example will be added as follows:

Test3

|----Meta-inf

|----Manifesat. Mf

|----HR

|----...... Omitted

Example 3: test4 and TEST5 folders are hit in Test4-5.jar, method:

  

Results: The Test4-5.jar,jar package directory structure under Jar-example will be added as follows:

Test4-5

|----Meta-inf

|----Manifesat. Mf

|----TEST4

|----...... Omitted

|----TEST4

|----...... Omitted

Example 4: Put Jar-example under All files (!) All into Test6.jar,

The file structure before packaging

  

Packaging methods (perform operations in the Jar-example directory):

  

Post-packaged file structure:

  

Result: The directory for the jar package is as follows:

Test6

|----Meta-inf

|----Manifesat. Mf

|----TEST4

|----...... Omitted

|----TEST5

|----...... Omitted

|----1.class

|----2.class

Example 5: Test8 folder and content into the Test8.jar, do not generate MANIFESAT.MF file, method:

F:\jar-example>jar CVFM Test8.jar Test

Result: The directory for the jar package is as follows:

Test8

  |----TEST8

Example 6: Use the existing manifest file "MYMANIFEST.MF" and hit the file in the test into Test.jar. At this point in the Operation directory, to have "mymanifest.mf" file, Method:

F:\jar-example>jar CVFM Test.jar MYMANIFEST.MF test

The resulting file directory is the same as Example 2, except that the contents of the MANIFEST.MF file in the jar package are content in MYMANIFEST.MF.

Example 7: Adding files to the original Test7.jar, such as MYMAINFEST.MF, method:

  

The results are as follows (the structure in the jar package):

  

If you use the-m parameter and specify the MANIFEST.MF file, then MANIFEST.MF is manifest as a manifest file. MF to use, its content will be added to the MANIFEST. MF; However, it is then added to the JAR package as a generic file, which is the same as a generic file.

Second, use the compression tool to hit the jar bag

The knowledge is limited and will be supplemented with new places later.

Three

Executable jar package, and some other knowledge of jar package, reference http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=137481 write well.

How to play jar bag learning notes

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.