/** * Load named class either via the system classloader or a given * custom classloader. * * As a side effect, the loader is set as the thread context classloader * @param classname the name of the class to load. * @return the requested class. */ private Class<?> loadClass(final String classname) throws ClassNotFoundException { setupLoader(); if (loader == null) { return Class.forName(classname); } return Class.forName(classname, true, loader); }