这个压缩包里的都是超级经典的java例子
源代码在线查看: writefile.htm
Writing a JAR File Manifest to a File (Java Developers Almanac Example)
The Java Developers Almanac 1.4
Order this book from Amazon.
google_ad_client = "pub-6001183370374757";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_channel = "4777242811";
google_ad_type = "text_image";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "6666CC";
google_color_url = "6666CC";
google_color_text = "000000";
//-->
Home
>
List of Packages
>
java.util.jar
[5 examples]
e383. Writing a JAR File Manifest to a File
The format of a manifest file is described in:
http://java.sun.com/products/jdk/1.2/docs/guide/jar/manifest.html
This example retrieves the manifest from a JAR file and writes the
manifest contents to a file.
try {
// Open the JAR file
JarFile jarfile = new JarFile("filename.jar");
// Get the manifest
Manifest manifest = jarfile.getManifest();
// Write the manifest to a file
OutputStream fos = new FileOutputStream("manifest");
jarfile.getManifest().write(fos);
fos.close();
} catch (IOException e) {
}
Here's an example of a manifest file:
Manifest-Version: 1.0
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-rc (Sun Microsystems Inc.)
Implementation-Vendor: Sun Microsystems, Inc.
Specification-Vendor: Sun Microsystems, Inc.
Name: javax/swing/JScrollPane.class
Java-Bean: True
Name: javax/swing/JCheckBoxMenuItem.class
Java-Bean: True
Name: javax/swing/JTabbedPane.class
Java-Bean: True
Name: javax/swing/JMenuItem.class
Java-Bean: True
Name: javax/swing/JTable.class
Java-Bean: True
Related Examples
e380.
Listing the Entries of a JAR File Manifest
e381.
Listing the Main Attributes in a JAR File Manifest
e382.
Creating a Manifest for a JAR File
e384.
Creating and Signing a JAR File Using jarsigner
© 2002 Addison-Wesley.