📄 e381. listing the main attributes in a jar file manifest.txt
字号:
The main attributes of a JAR file are values that are associated with the JAR file itself, not with any particular entry.
try {
// Open the JAR file
JarFile jarfile = new JarFile("filename.jar");
// Get the manifest
Manifest manifest = jarfile.getManifest();
// Get the main attributes in the manifest
Attributes attrs = (Attributes)manifest.getMainAttributes();
// Enumerate each attribute
for (Iterator it=attrs.keySet().iterator(); it.hasNext(); ) {
// Get attribute name
Attributes.Name attrName = (Attributes.Name)it.next();
// Get attribute value
String attrValue = attrs.getValue(attrName);
}
} catch (IOException e) {
}
Here's an example of main attributes for a JAR file:
Attribute Name: Attribute Value
Specification-Title: Java Platform API Specification
Specification-Version: 1.4
Implementation-Title: Java Runtime Environment
Implementation-Version: 1.4.0-rc
Created-By: 1.4.0 (Sun Microsystems Inc.)
Manifest-Version: 1.0
Implementation-Vendor: Sun Microsystems, Inc.
Specification-Vendor: Sun Microsystems, Inc.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -