java.net.URLClassLoader#findResources ( )源码实例Demo

下面列出了java.net.URLClassLoader#findResources ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: util4j   文件: TestUrlClassLoader.java
public static void testDir()throws Exception
	{
		File f=new File("C:/Users/Administrator/git/util4j/util4j/target/classes");
		URL url=f.toURI().toURL();
		URL[] urls=new URL[]{url};
		URLClassLoader loader=new URLClassLoader(urls);
//		loader.close();
		Class c1=loader.loadClass("net.jueb.util4j.math.CombinationUtil");
		System.out.println(c1);
		Class c2=loader.loadClass("net.jueb.util4j.math.CombinationUtil$CombinationController");
		System.out.println(c2);
		Class c3=loader.loadClass("net.jueb.util4j.math.CombinationUtil$ForEachByteIndexController");
		System.out.println(c3);
		Enumeration<URL> ss=loader.findResources("*.class");
		System.out.println(ss.hasMoreElements());
		CombinationUtil c22=(CombinationUtil) c1.newInstance();
		System.out.println(c22);
		loader.close();
		c1=loader.loadClass("net.jueb.util4j.math.CombinationUtil");
		System.out.println(c1);
	}
 
源代码2 项目: TencentKona-8   文件: Options.java
/**
 * Finds the <tt>META-INF/sun-jaxb.episode</tt> file to add as a binding customization.
 */
public void scanEpisodeFile(File jar) throws BadCommandLineException {
    try {
        URLClassLoader ucl = new URLClassLoader(new URL[]{jar.toURL()});
        Enumeration<URL> resources = ucl.findResources("META-INF/sun-jaxb.episode");
        while (resources.hasMoreElements()) {
            URL url = resources.nextElement();
            addBindFile(new InputSource(url.toExternalForm()));
        }
    } catch (IOException e) {
        throw new BadCommandLineException(
                Messages.format(Messages.FAILED_TO_LOAD,jar,e.getMessage()), e);
    }
}
 
源代码3 项目: jdk8u60   文件: Options.java
/**
 * Finds the <tt>META-INF/sun-jaxb.episode</tt> file to add as a binding customization.
 */
public void scanEpisodeFile(File jar) throws BadCommandLineException {
    try {
        URLClassLoader ucl = new URLClassLoader(new URL[]{jar.toURL()});
        Enumeration<URL> resources = ucl.findResources("META-INF/sun-jaxb.episode");
        while (resources.hasMoreElements()) {
            URL url = resources.nextElement();
            addBindFile(new InputSource(url.toExternalForm()));
        }
    } catch (IOException e) {
        throw new BadCommandLineException(
                Messages.format(Messages.FAILED_TO_LOAD,jar,e.getMessage()), e);
    }
}
 
源代码4 项目: openjdk-jdk8u   文件: Options.java
/**
 * Finds the <tt>META-INF/sun-jaxb.episode</tt> file to add as a binding customization.
 */
public void scanEpisodeFile(File jar) throws BadCommandLineException {
    try {
        URLClassLoader ucl = new URLClassLoader(new URL[]{jar.toURL()});
        Enumeration<URL> resources = ucl.findResources("META-INF/sun-jaxb.episode");
        while (resources.hasMoreElements()) {
            URL url = resources.nextElement();
            addBindFile(new InputSource(url.toExternalForm()));
        }
    } catch (IOException e) {
        throw new BadCommandLineException(
                Messages.format(Messages.FAILED_TO_LOAD,jar,e.getMessage()), e);
    }
}
 
源代码5 项目: openjdk-jdk8u-backup   文件: Options.java
/**
 * Finds the <tt>META-INF/sun-jaxb.episode</tt> file to add as a binding customization.
 */
public void scanEpisodeFile(File jar) throws BadCommandLineException {
    try {
        URLClassLoader ucl = new URLClassLoader(new URL[]{jar.toURL()});
        Enumeration<URL> resources = ucl.findResources("META-INF/sun-jaxb.episode");
        while (resources.hasMoreElements()) {
            URL url = resources.nextElement();
            addBindFile(new InputSource(url.toExternalForm()));
        }
    } catch (IOException e) {
        throw new BadCommandLineException(
                Messages.format(Messages.FAILED_TO_LOAD,jar,e.getMessage()), e);
    }
}
 
源代码6 项目: openjdk-jdk9   文件: Options.java
/**
 * Finds the {@code META-INF/sun-jaxb.episode} file to add as a binding customization.
 *
 * @param jar
 * @throws com.sun.tools.internal.xjc.BadCommandLineException
 */
public void scanEpisodeFile(File jar) throws BadCommandLineException {
    try {
        URLClassLoader ucl = new URLClassLoader(new URL[]{jar.toURL()});
        Enumeration<URL> resources = ucl.findResources("META-INF/sun-jaxb.episode");
        while (resources.hasMoreElements()) {
            URL url = resources.nextElement();
            addBindFile(new InputSource(url.toExternalForm()));
        }
    } catch (IOException e) {
        throw new BadCommandLineException(
            Messages.format(Messages.FAILED_TO_LOAD, jar, e.getMessage()), e);
    }
}
 
源代码7 项目: hottub   文件: Options.java
/**
 * Finds the <tt>META-INF/sun-jaxb.episode</tt> file to add as a binding customization.
 */
public void scanEpisodeFile(File jar) throws BadCommandLineException {
    try {
        URLClassLoader ucl = new URLClassLoader(new URL[]{jar.toURL()});
        Enumeration<URL> resources = ucl.findResources("META-INF/sun-jaxb.episode");
        while (resources.hasMoreElements()) {
            URL url = resources.nextElement();
            addBindFile(new InputSource(url.toExternalForm()));
        }
    } catch (IOException e) {
        throw new BadCommandLineException(
                Messages.format(Messages.FAILED_TO_LOAD,jar,e.getMessage()), e);
    }
}
 
源代码8 项目: openjdk-8-source   文件: Options.java
/**
 * Finds the <tt>META-INF/sun-jaxb.episode</tt> file to add as a binding customization.
 */
public void scanEpisodeFile(File jar) throws BadCommandLineException {
    try {
        URLClassLoader ucl = new URLClassLoader(new URL[]{jar.toURL()});
        Enumeration<URL> resources = ucl.findResources("META-INF/sun-jaxb.episode");
        while (resources.hasMoreElements()) {
            URL url = resources.nextElement();
            addBindFile(new InputSource(url.toExternalForm()));
        }
    } catch (IOException e) {
        throw new BadCommandLineException(
                Messages.format(Messages.FAILED_TO_LOAD,jar,e.getMessage()), e);
    }
}
 
源代码9 项目: openjdk-8   文件: Options.java
/**
 * Finds the <tt>META-INF/sun-jaxb.episode</tt> file to add as a binding customization.
 */
public void scanEpisodeFile(File jar) throws BadCommandLineException {
    try {
        URLClassLoader ucl = new URLClassLoader(new URL[]{jar.toURL()});
        Enumeration<URL> resources = ucl.findResources("META-INF/sun-jaxb.episode");
        while (resources.hasMoreElements()) {
            URL url = resources.nextElement();
            addBindFile(new InputSource(url.toExternalForm()));
        }
    } catch (IOException e) {
        throw new BadCommandLineException(
                Messages.format(Messages.FAILED_TO_LOAD,jar,e.getMessage()), e);
    }
}