?? 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 + -