Here you can find the source of getJarManifest(File file)
public static Manifest getJarManifest(File file) throws IOException
//package com.java2s; /*// ww w.j ava 2s.c o m * Copyright (c) 2006-2012 Nuxeo SA (http://nuxeo.com/) and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Nuxeo - initial API and implementation * * $Id$ */ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.net.URL; import java.util.jar.JarFile; import java.util.jar.Manifest; public class Main { public static Manifest getJarManifest(File file) throws IOException { JarFile jar = null; try { jar = new JarFile(file); return jar.getManifest(); } finally { if (jar != null) { jar.close(); } } } public static Manifest getManifest(File file) { try { if (file.isDirectory()) { return getDirectoryManifest(file); } else { return getJarManifest(file); } } catch (IOException ignored) { return null; } } public static Manifest getManifest(URL url) { try { return new JarFile(new File(url.getFile())).getManifest(); } catch (IOException e) { return null; } } public static Manifest getDirectoryManifest(File file) throws IOException { FileInputStream fis = null; try { fis = new FileInputStream(new File(file, "META-INF/MANIFEST.MF")); return new Manifest(fis); } finally { if (fis != null) { fis.close(); } } } }