Java – jar manifest file – difference between specification and Implementation

I want to add version information (and possibly some other metadata about jars) to the jars of a library I created However, I don't know what attribute to use I found that the specification and documentation explain that there can be a specification version and implementation Version (as well as their titles and suppliers) However, it can not correctly explain the difference between specification and implementation

I have also seen different examples

>A package name in documentation that uses "readable name" and "implementation title" of "executable title" Specification versions use dots to separate version numbers, while implementation versions use simple version numbers. > It seems that the graduation thesis tutorial only uses the implementation version and a personalized string to implement the title > in another question, I found an example with several implementation versions of different packages

What is the difference between the specification and the implementation metadata here? How should these different attributes (especially the version number) be used? Are the suppliers of specification and implementation different?

Did it even play my role there?

Solution

The meaning of each is in the document of Java Lang. package

Specification version must consist of a sequence of ASCII numbers separated by ASCII cycles Other characters are not allowed, the period cannot be at the beginning or end of the value, and continuous periods are not allowed

Implementation - version is a free - form string It can have any format

Specification – the version is always associated with the package If you specify for the entire manifest, rather than for a specific package, it applies to All packages in the jar file

Specification version is used by many Java technologies as a means to solve dependencies If some programs say they need version 2.1 or higher of the JMF library, some Java environments will analyze the numbers in the specification version of each listing, have a matching specification title, and ensure that the correct version (and no other version) is available in the classpath at run time

In fact, package The iscompatiblewith method is indeed very checking You can even use it to check the minimum java version:

if (System.class.getPackage().isCompatibleWith("1.6")) {
    System.out.println("Running in Java 1.6 or later.");
}
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>