Skip to content

Instantly share code, notes, and snippets.

@yujuwon
Created January 3, 2013 01:22
Show Gist options
  • Save yujuwon/4440027 to your computer and use it in GitHub Desktop.
Save yujuwon/4440027 to your computer and use it in GitHub Desktop.
import java.io.File;
import java.net.URL;
import java.net.URLClassLoader;
public class DynamicLibCall
{
public static void main(String[] args)
{
String libPath = "DynamicLib.jar";
File libFile = new File(libPath);
URL classURL = new URL("jar:" + file.toURI().toURL() + "!/");
URLClassLoader classLoader = new URLClassLoader(new URL [] {classURL});
Class test1 = classLoader.loadClass("com.company.test.test1");
Object obj1 = clazz1.newInstance();
System.out.println(obj1.toString());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment