How to check the order of MANIFEST.MF in a bank?

I had an interesting problem, completely new to me. As I discovered, the Jar specification says that when included, META-INF and MANIFEST.MF should be the first and second occurrences of the *.jar package, not just the directory and file in the archive.

I work with the Java infrastructure, very carefully observing this requirement and not so many details. How to check the correct ordering of META-INF and MANIFEST.MF in jar?

UPDATE: Many banks are third-party, and many of them. I cannot open these banks in notepad, excel, hexeditor, photoshop or in any case that searches for byte sequences. I need a command line tool. Thanks!

UPDATE 2: That's why I ask this question: http://www.mail-archive.com/ dev@felix.apache.org /msg17097.html

+6
java jar packaging
source share
3 answers

The following command lists the contents of the JAR in the following order:

 jar tf foo.jar 

Note that there is no actual requirement for a first appearance in the JAR specification for META-INF/MANIFEST.MF . However, JARs created with the jar tool (supplied with the JDK) do have the first manifest, and therefore it has become a convention.

+5
source share

The jar tool with the JDK automatically adds them first, so you have nothing to do. If you really want to check, get a hex editor and look at the lines "META-INF" and "MANIFEST.MF" before any other file names.

+2
source share

To fix broken JARs:

 $ mkdir foo $ cd foo $ jar xvf ../broken.jar $ mv META-INF/MANIFEST.MF /tmp/mymanifest $ jar cvfm fixed.jar /tmp/mymanifest . 

SM.: MANIFEST.MF should be the first resource in the jar file - here's how to fix broken banks

+1
source share

All Articles