Search code examples
javajarmanifestmanifest.mf

Using tools that the JDK and/or JRE provide, is there a way to view the Manifest file for a given JAR?


I'm able to read the Manifest file inside of my Java code, but I would also like to know if it's possible, and if it is, how to open up a JAR file from the command line and view its Manifest.MF file, or at the very least be able to specify a property of the Manifest.MF file and view it's value.


Solution

  • From here:

    You can extract selected entries from a jar file. For instance, if you only want to view the meta-inf/manifest.mf file, you can

    C:\Sun\AppServer\lib>jar xvf j2ee.jar META-INF/MANIFEST.MF
    inflated: META-INF/MANIFEST.MF
    

    Or using a backslash instead of a forward slash:

    C:\Sun\AppServer\lib>jar xvf j2ee.jar META-INF\MANIFEST.MF
    inflated: META-INF/MANIFEST.MF
    

    The entry names are case sensitive, and so the following will not extract anything:

     C:\Sun\AppServer\lib>jar xvf j2ee.jar meta-inf/manifest.mf
    

    Of course, you can always double-click the entry to view it in WinZip, fileroller, or other tools.