Introduction
JAR files support a wide range of functionality, including electronic signing, version control, package sealing, and others. What gives a JAR file this versatility? The answer is the JAR file’s manifest.
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.
This example will explain the contents of the manifest file and show you how to work with it, with examples for the basic features.
For more information about the MANIFEST See https://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html
try { // Open the JAR file JarFile jarfile = new JarFile("filename.jar"); // Get the manifest Manifest manifest = jarfile.getManifest(); // Get the manifest entries Map map = manifest.getEntries(); // Enumerate each entry for (Iterator it=map.keySet().iterator(); it.hasNext(); ) { // Get entry name String entryName = (String)it.next(); // Get all attributes for the entry Attributes attrs = (Attributes)map.get(entryName); // Enumerate each attribute for (Iterator it2=attrs.keySet().iterator(); it2.hasNext(); ) { // Get attribute name Attributes.Name attrName = (Attributes.Name)it2.next(); // Get attribute value String attrValue = attrs.getValue(attrName); } } } catch (IOException e) { }
Hello This piece of writing will help the internet users for setting up new blog or even a blog from start to end.vielen dank