Java Class Loader loadManifestFrom(Class c)

Here you can find the source of loadManifestFrom(Class c)

Description

load Manifest From

License

Apache License

Declaration

static Manifest loadManifestFrom(Class<?> c) throws ClassNotFoundException, IOException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;

import java.util.jar.Manifest;

public class Main {
    static Manifest loadManifestFrom(Class<?> c) throws ClassNotFoundException, IOException {
        URLClassLoader cl = (URLClassLoader) c.getClassLoader();
        URL url = cl.findResource("META-INF/MANIFEST.MF");
        Manifest manifest = new Manifest(url.openStream());
        return manifest;
    }//from  ww  w . j av a2s  .c o m

    static Manifest loadManifestFrom(String cn) throws ClassNotFoundException, IOException {
        return loadManifestFrom(Class.forName(cn));
    }
}

Related

  1. loadClassifiers(String dataDirectoryName)
  2. loadConfig(String path, ClassLoader classLoader)
  3. loadForClass(final Class clazz, final String filename)
  4. loadManifest(Class manifestFileClass)
  5. loadManifest(Class theClass)
  6. loadProperties(final Properties properties, final String fileName, final ClassLoader cl)
  7. loadStyleSheet(Class type)
  8. loadTextFile(Class relToThisClass, String relFileName)
  9. pathFromLoaders(final Class clazz)