A JAR file has a manifest file situated in the path META-INF/MANIFEST.MF. The entries in the manifest file conclude how the JAR file will be used. JAR files which are intended to be executed as separate programs will have one of their classes specified as the "main" class. The obvious file would have an entry such as
Main-Class: myPrograms.MyClass
Such JAR files are characteristically started with a command similar to
java -jar foo.jar
These files can also include a Classpath entry, which identifies other JAR files to be overloaded with the JAR. This entry consists of a list of absolute or relation paths to other JAR files. Although intended to simplify JAR use, in practice, it turns out to be infamously brittle as it depends on all the relevant JARs being in the exact locations specified when the entry-point JAR was built. To change versions or locations of libraries, a new manifest is required.
No comments:
Post a Comment