Classpaths and reflection-Collection of common programming errors
You can use JavaAssist lib to include new classpaths or modify classes at runtime.
Here is a brief tutorial
You can register a directory name as the class search path. For example, the following code adds a directory /usr/local/javalib to the search path:
ClassPool pool = ClassPool.getDefault();
pool.insertClassPath("/usr/local/javalib");
The search path that the users can add is not only a directory but also a URL:
ClassPool pool = ClassPool.getDefault();
ClassPath cp = new URLClassPath("www.javassist.org", 80, "/java/", "org.javassist.");
pool.insertClassPath(cp);