Can I access the values defined in a java manifest from code?
+3
A:
Open the file with JarFile
and then call getManifest()
to get the Manifest
. After that you can access the attributes appropriately.
Jon Skeet
2010-02-04 09:31:03
THis is even more flexible. Thank you!
er4z0r
2010-02-09 09:37:00
+4
A:
Many of the values in the MANIFEST.MF can be accessed programmatically without having to find and/or open the jar file itself.
The class java.lang.Package
provides access to the ImplementationTitle
, ImplementationVendor
, ImplementationVersion
, SpecificationTitle
, SpecificationVendor
and the SpecificationVersion
.
Information about signed classes can be found using the CodeSource
class, which can be retrieved via Class
.getProtectionDomain()
.getCodeSource()
Joachim Sauer
2010-02-04 09:38:01
Personally I don't know, but it seems like it: http://developer.android.com/reference/java/lang/package-summary.html
Joachim Sauer
2010-02-04 11:24:00
Thanks. I checked it again and found that Jon's solution provides more flexiblity and is available on android as well.
er4z0r
2010-02-09 09:38:44