Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 733
Thomas Owens Avatar asked Dec 17 '22 07:12

Thomas Owens


2 Answers

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.

like image 186
VonC Avatar answered Jan 14 '23 13:01

VonC


Something like this should work:

jar -xf <jarfile.jar> META-INF/MANIFEST.MF
like image 20
Jack Leow Avatar answered Jan 14 '23 13:01

Jack Leow