Code example for URLClassLoader

Methods: loadClass

0
        // Construct an URL for loading the file 
        URL driverURL = new URL( "file:" + driverFile );
 
        // Load the driver using the sytem class loader 
        ClassLoader parent = ClassLoader.getSystemClassLoader();
        URLClassLoader loader = new URLClassLoader( new URL[]
        { driverURL }, parent );
        Class driverClass = loader.loadClass( clazz );
 
        // Cache the driver 
        m_driver = (Driver) driverClass.newInstance();
    } 
 
} 
Experience pair programming with AI  Get Codota for Java