public synchronized int exportObject(String name,Object obj) throws CannotCompileException {
  Class clazz=obj.getClass();
  ExportedObject eo=new ExportedObject();
  eo.object=obj;
  eo.methods=clazz.getMethods();
  exportedObjects.addElement(eo);
  eo.identifier=exportedObjects.size() - 1;
  if (name != null)   exportedNames.put(name,eo);
  try {
    stubGen.makeProxyClass(clazz);
  }
 catch (  NotFoundException e) {
    throw new CannotCompileException(e);
  }
  return eo.identifier;
}

public synchronized int exportObject ( String name , Object obj ) throws CannotCompileException { Class clazz = obj . getClass ( ) ; ExportedObject eo = new ExportedObject ( ) ; eo . object = obj ; eo . methods = clazz . getMethods ( ) ; exportedObjects . addElement ( eo ) ; eo . identifier = exportedObjects . size ( ) - 1 ; if ( name != null ) exportedNames . put ( name , eo ) ; try { stubGen . makeProxyClass ( clazz ) ; } catch ( NotFoundException e ) { throw new CannotCompileException ( e ) ; } return eo . identifier ; }
exports an object . this method produces the bytecode of the proxy class used to access the exported object . a remote applet can load the proxy class and call a method on the exported object .
