Latest News

 










A Custom Class Loader Part C

Previous slide Next slide Back to first slide View graphic version


A Custom Class Loader Part C


 
My other sites

Latest News

 










A Custom Class Loader Part C

    //don’t attempt to load a system file (for Java 1.1)


    if (typeName.startsWith(“java.”)) {

    throw new ClassNotFoundException();

    }

    //try to load it from subdirectory “hole”

    byte[] typeData = getTypeFromHole(typeName);

    if (typeData == null) {

    throw new ClassNotFoundException();

    }

    //parse it

    result =

    defineClass(typeName, typeData, 0, typeData.length);

    if (result == null) { throw new ClassFormatError(); }

    if (resolveIt) { resolveClass(result); }

    //Return class from hole

    return result;

    } }

Previous slide Next slide Back to first slide View graphic version