欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

将jar包的manifest信息写入到文件,jar包manifest写入,package cn.o

来源: javaer 分享于  点击 1816 次 点评:173

将jar包的manifest信息写入到文件,jar包manifest写入,package cn.o


package cn.outofmemory.snippets.core;import java.io.FileOutputStream;import java.io.OutputStream;import java.util.jar.JarFile;import java.util.jar.Manifest;public class WriteJARFileManifestToFile {    public static void main(String[] args) throws Exception {        // create a new JAR file to read from the specified file        JarFile jarfile = new JarFile("jsp-api.jar");        // get the manifest for that file        Manifest manifest = jarfile.getManifest();        // write the manifest to a file        OutputStream fos = new FileOutputStream("Manifest.MF");        manifest.write(fos);        fos.close();    }}

输出:

Manifest-Version: 1.0Ant-Version: Apache Ant 1.8.0Created-By: 1.6.0_20-b02 (Sun Microsystems Inc.)X-Compile-Source-JDK: 1.6X-Compile-Target-JDK: 1.6Name: javax/servlet/jsp/Implementation-Vendor: Apache Software FoundationSpecification-Title: Java API for JavaServer PagesImplementation-Title: javax.servlet.jspImplementation-Version: 2.2.FRSpecification-Version: 2.2Specification-Vendor: Sun Microsystems, Inc.
相关栏目:

用户点评