Can values defined in MANIFEST.MF be accessed programmatically?

后端 未结 5 2082
暖寄归人
暖寄归人 2020-11-30 12:49

Can I access the values defined in a java manifest from code?

5条回答
  •  青春惊慌失措
    2020-11-30 12:59

    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()

提交回复
热议问题