Here you can find the source of loadManifest(File bundleLocation)
public static Dictionary loadManifest(File bundleLocation) throws IOException
//package com.java2s; /******************************************************************************* * Copyright (c) 2006 IBM Corporation 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://from w w w.j a v a 2 s . c om * IBM Corporation - initial API and implementation *******************************************************************************/ import java.io.*; import java.util.*; import java.util.jar.*; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import org.eclipse.core.runtime.*; public class Main { public static Dictionary loadManifest(File bundleLocation) throws IOException { ZipFile jarFile = null; InputStream manifestStream = null; try { String extension = new Path(bundleLocation.getName()).getFileExtension(); bundleLocation = new File(bundleLocation.getAbsolutePath()); if (extension != null && (extension.equals("jar") || extension.equals("jar!")) //$NON-NLS-1$//$NON-NLS-2$ && bundleLocation.isFile()) { jarFile = new ZipFile(bundleLocation, ZipFile.OPEN_READ); ZipEntry manifestEntry = jarFile.getEntry(JarFile.MANIFEST_NAME); if (manifestEntry != null) { manifestStream = jarFile.getInputStream(manifestEntry); } } else { File file = new File(bundleLocation, JarFile.MANIFEST_NAME); if (file.exists()) manifestStream = new FileInputStream(file); } } catch (IOException e) { } if (manifestStream == null) return null; try { Manifest m = new Manifest(manifestStream); return manifestToProperties(m.getMainAttributes()); } finally { try { manifestStream.close(); } catch (IOException e1) { } try { if (jarFile != null) jarFile.close(); } catch (IOException e2) { } } } public static Properties manifestToProperties(Attributes d) { Iterator iter = d.keySet().iterator(); Properties result = new Properties(); while (iter.hasNext()) { Attributes.Name key = (Attributes.Name) iter.next(); result.put(key.toString(), d.get(key)); } return result; } }