Code example for PathClassLoader

0
    private static void initClassLoader(final Context ctx) throws NameNotFoundException {
        if (stubClassLoader != null) {
            return; 
        } 
        ApplicationInfo vpnAppInfo = ctx.getPackageManager().getApplicationInfo(STUB_PACK, 0);
        stubClassLoader = new PathClassLoader(vpnAppInfo.sourceDir, ClassLoader.getSystemClassLoader());
    } 
 
    protected static final Class<?> loadClass(final String qname) throws ClassNotFoundException {
            return Class.forName(qname, true, stubClassLoader);
    } 
 
    @SuppressWarnings("unchecked") 
    protected <T> T invokeStubMethod(final String methodName, final Object... args) {
        try { 
            Method method = findStubMethod(methodName, args);
            return (T) method.invoke(stub, args);
        } catch (Exception e) {
            throw new WrapperException("failed to invoke mehod '" + methodName + "' on stub", e);
        } 
    }