reading MANIFEST.MF file from jar file using JAVA

M.J. picture M.J. · Sep 23, 2010 · Viewed 67.4k times · Source

Is there any way i can read the contents of a jar file. like i want to read the manifest file in order to find the creator of the jar file and version. Is there any way to achieve the same.

Answer

oiavorskyi picture oiavorskyi · Sep 23, 2010

Next code should help:

JarInputStream jarStream = new JarInputStream(stream);
Manifest mf = jarStream.getManifest();

Exception handling is left for you :)