Retrieves the manifest from a JAR file and writes the manifest contents to a file.
import java.io.FileOutputStream; import java.io.OutputStream; import java.util.jar.JarFile; import java.util.jar.Manifest; public class Main { public static void main(String[] argv) throws Exception { JarFile jarfile = new JarFile("filename.jar"); Manifest manifest = jarfile.getManifest(); OutputStream fos = new FileOutputStream("manifest"); jarfile.getManifest().write(fos); fos.close(); } }