Java Jar File Load loadJar(String path)

Here you can find the source of loadJar(String path)

Description

load Jar

License

Apache License

Declaration

public static ClassLoader loadJar(String path) throws MalformedURLException 

Method Source Code


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

import java.io.File;

import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;

public class Main {
    public static ClassLoader loadJar(String path) throws MalformedURLException {
        URL url = new File(path).toURI().toURL();
        URL[] urls = new URL[] { url };
        return new URLClassLoader(urls);
    }/*from   w  w w.ja  v a2 s. co m*/
}

Related

  1. loadClassesFromJar(final String jarPath, final CharSequence matchingPath)
  2. loadClassFromJar(String jarAbsolutePath, String className)
  3. loadJar(File jar)
  4. loadJar(String jarPath)
  5. loadJarFile(File jarFile, String className)
  6. loadJarInSystemClassLoader(File out)
  7. loadJarIntoClasspath(File jarFile)
  8. loadJarsFromDir(final File dir)