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.
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.
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.
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.
Next code should help:
JarInputStream jarStream = new JarInputStream(stream); Manifest mf = jarStream.getManifest();
Exception handling is left for you :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With