What is Manifest-Version in MANIFEST.MF?
Asked Answered
D

1

15

In the MANIFEST.MF file found in JARs, the first line is Manifest-Version: 1.0. According to the Java Tutorials, this first line says that "the default manifest conforms to version 1.0 of the manifest specification".

So in what cases would the Manifest-Version be anything other than 1.0?

Also, what is the manifest specification? Why must the default manifest conform to it? I've seen multiple explanations explaining again that "the default manifest conforms to version 1.0 of the manifest specification" but none explaining what the manifest specification is.

Duress answered 15/12, 2014 at 5:35 Comment(0)
E
8

The JAR File Specification - Manifest Specification states,

Manifest-Version: Defines the manifest file version. The value is a legitimate version number, as described in the above spec.

And version number is

version-number : digit+{.digit+}*

There is also a note

Versions:

Manifest-Version and Signature-Version must be first, and in exactly that case (so that they can be recognized easily as magic strings). Other than that, the order of attributes within a main section is not significant.

I don't believe Sun or Oracle has ever released another version of the Manifest Specification (but they could, and this allows them to provide future proofing). Also, it's treated as a magic string.

Ectogenous answered 15/12, 2014 at 5:41 Comment(2)
So is Manifest-Version the version of the actual manifest file in the JAR, or is it the version of the manifest specification in the JAR File Specification?Duress
@Rees the second one.Ectogenous

© 2022 - 2024 — McMap. All rights reserved.