public DocletInvoker(Messager messager,
                         String docletClassName, String docletPath,
                         ClassLoader docletParentClassLoader) {
        this.messager = messager;
        this.docletClassName = docletClassName;

        // construct class loader
        String cpString = null;   // make sure env.class.path defaults to dot

        // do prepends to get correct ordering
        cpString = appendPath(System.getProperty("env.class.path"), cpString);
        cpString = appendPath(System.getProperty("java.class.path"), cpString);
        cpString = appendPath(docletPath, cpString);
        URL[] urls = pathToURLs(cpString);
        if (docletParentClassLoader == null) {
            appClassLoader =
                new URLClassLoader(urls,
                                   getDelegationClassLoader(docletClassName));
        } else {
            appClassLoader = new URLClassLoader(urls, docletParentClassLoader);
        }

        // attempt to find doclet
        Class dc = null;
        try {
            dc = appClassLoader.loadClass(docletClassName);
        } catch (ClassNotFoundException exc) {
            messager.error(null, "main.doclet_class_not_found", docletClassName);
            messager.exit();
        }
        docletClass = dc;
    }