How to access the Manifest from inside the jar file?
807588May 14 2009 — edited May 15 2009There's a java.util.jar.JarFile class, which seems to give access to its Manifest, which allows to access its Attributes.
This seems very nice, e.g to store application-wide information (like version info).
I managed to write and build an application, put it into a jar and run it from there.
Now my questions:
How can my code access its own jar file?
Is URL myURL = ClassLoader.getResource("META-INF/MANIFEST.MF") the way to go or is there a more elegant way ?
What's the special purpose/benefit of MANIFEST.MF over any text file as a Resource anywhere in the jar (or on the classpath) ?
Anything to consider regarding debugging support (Eclipse is my favorite) before packing it into the jar ?
Alternatively, if those questions do not make sense, a hint where to learn more about "what's the purpose of a manifest inside a jar file" ?