读取jar包的manifest信息 并写入到文件

阅读更多

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();

 

    }

 

}

 

出处:http://outofmemory.cn/code-snippet/363/jiang-jar-bao-manifest-information-xieru-come-file

 

你可能感兴趣的:(jar,manifest)