/**
   * Creates an instance of the specified class that implements AppInterface, and returns a Proxy to
   * the instance. The returned Proxy invokes all methods of the target instance in the context of
   * the ClassLoader of the specified class.
   */
  private AppInterface newAppObject(final int appVersion) throws Exception {

    AppInterface app =
        (AppInterface)
            Proxy.newProxyInstance(
                AppInterface.class.getClassLoader(),
                new Class[] {AppInterface.class},
                new MyInvocationHandler(appClasses[appVersion].newInstance()));

    app.setVersion(appVersion);
    app.setInitDuringOpen(doInitDuringOpen);

    return app;
  }