// Creating a class instance without a custom ClassLoader
MyClass instance1 = new MyClass();

// create a custom ClassLoader.You must write the code for LocalClassLoader.
ClassLoader localLoader = new LocalClassLoader();

// load a class, distinct from MyClass loaded normally or via Class.classForName
Class myclass = localLoader.loadClass( "com.mindprod.mypackage.MyClass" );

// create a new MyClass object, can't cast to MyClass!
MyInterface instance2 = (MyInterface)localLoader.loadClass( "com.mindprod.mypackage.MyClass" ).newInstance();

// installing your classloader as the one to use from now on
Thread.currentThread().setContextClassLoader( classLoader );