Here you can find the source of loadManifest(Class manifestFileClass)
public static Manifest loadManifest(Class manifestFileClass)
//package com.java2s; //License from project: Apache License import java.io.File; import java.net.URL; import java.util.jar.JarFile; import java.util.jar.Manifest; public class Main { public static Manifest loadManifest(Class manifestFileClass) { try {/*from w w w .j a va2s. c o m*/ URL jarFileLocation = manifestFileClass.getClassLoader() .getResource(manifestFileClass.getName().replace(".", "/") + ".class"); if (jarFileLocation != null) { String jarFilePath = jarFileLocation.getFile(); jarFilePath = jarFilePath.substring(0, jarFilePath.indexOf("!")); if (jarFilePath.startsWith("file:")) { jarFilePath = jarFilePath.substring(jarFilePath.indexOf(":") + 1); } JarFile file = new JarFile(new File(jarFilePath)); return file.getManifest(); } } catch (Throwable ignored) { } return new Manifest(); } }