Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reading MANIFEST.MF file from jar file using JAVA

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.

like image 236
M.J. Avatar asked Sep 23 '10 09:09

M.J.


People also ask

How do I view the manifest of a JAR file?

NetBeans IDE This was easily brought up in NetBeans by simply using File --> Open File and selecting jdiff. jar to have it displayed as shown in the next screen snapshot.

How do I add manifest MF to JAR?

You use the m command-line option to add custom information to the manifest during creation of a JAR file. This section describes the m option. The Jar tool automatically puts a default manifest with the pathname META-INF/MANIFEST. MF into any JAR file you create.

What is manifest file in Java JAR?

The manifest is a special file that can contain information about the files packaged in a JAR file. By tailoring this "meta" information that the manifest contains, you enable the JAR file to serve a variety of purposes.


1 Answers

Next code should help:

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

Exception handling is left for you :)

like image 113
oiavorskyi Avatar answered Oct 01 '22 13:10

oiavorskyi