简体   繁体   中英

Jar command not adding requested manifest file to archive

I am running the following - and the resulting MANIFEST.MF does not contain the one referenced below:

jar -cvf instrument.jar -m instrument/META-INF/MANIFEST.MF -C instrument .

Here is the intended MANIFEST.MF:

18:23:20/shared $ll instrument/META-INF/MANIFEST.MF
-rw-r--r--  1 steve  staff  33 Mar 31 17:57 instrument/META-INF/MANIFEST.MF

Here is the resulting jar file (notice incorrect date/size of MANIFEST.MF)

18:34:02/shared $jar -tvf instrument.jar
     0 Tue Mar 31 17:58:58 PDT 2015 META-INF/
    68 Tue Mar 31 17:58:58 PDT 2015 META-INF/MANIFEST.MF
   544 Tue Mar 31 17:56:42 PDT 2015 ObjectSizeFetcher.cl

Here are contents of the intended manifest:

18:36:39/shared $cat instrument/META-INF/MANIFEST.MF
Premain-Class: ObjectSizeFetcher

Here are actual contents inside the jar file:

8:35:38/x2 $cat META-INF/MANIFEST.MF
Manifest-Version: 1.0
Created-By: 1.7.0_25 (Oracle Corporation)

You have to list all the options, except -C first, then the arguments (yeah, I know, original :)) and also provide the list of files to include

jar -cvfm instrument.jar instrument/META-INF/MANIFEST.MF -C instrument .

should do what you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM