Here you can find the source of load(String path, String className)
public static Class<?> load(String path, String className) throws Exception
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.io.File; import java.net.URL; import java.net.URLClassLoader; import java.util.Map; import com.google.common.collect.Maps; public class Main { private static final Map<String, Class<?>> classMap = Maps.newConcurrentMap(); public static Class<?> load(String path, String className) throws Exception { Class<?> clazz = classMap.get(className); if (clazz == null) { clazz = doLoad(path, className); if (clazz != null) { classMap.put(className, clazz); }/*from w w w.ja va 2 s.c o m*/ } return clazz; } private static Class<?> doLoad(String path, String className) throws Exception { File[] files = new File(path).listFiles(); URL urls[] = new URL[files.length]; for (int i = 0; i < files.length; ++i) { urls[i] = files[i].toURI().toURL(); } URLClassLoader urlClassLoader = new URLClassLoader(urls); return Class.forName(className, true, urlClassLoader); } }