global = new DynamicGlobalObject(this, app);
global = new GlobalObject(this, app, false);
    public RhinoCore(Application app) {        this.app = app;        wrappercache = new WeakCacheMap(500);        prototypes = new Hashtable();        Context context = Context.enter();        context.setCompileFunctionsWithDynamicScope(true);        context.setApplicationClassLoader(app.getClassLoader());        wrapper = new WrapMaker();        wrapper.setJavaPrimitiveWrap(false);        context.setWrapFactory(wrapper);        // Set up visual debugger if rhino.debug = true        if ("true".equals(app.getProperty("rhino.debug"))) {            initDebugger(context);        }        // Set default optimization level according to whether debugger is on        int optLevel = debugger == null ? 0 : -1;        try {            optLevel = Integer.parseInt(app.getProperty("rhino.optlevel"));        } catch (Exception ignore) {        }        context.setOptimizationLevel(optLevel);        try {            // create global object            global = new DynamicGlobalObject(this, app);            // call the initStandardsObject in ImporterTopLevel so that            // importClass() and importPackage() are set up.            global.initStandardObjects(context, false);            global.init();            pathProto = new PathWrapper(this);            hopObjectProto =  HopObject.init(this);            // use lazy loaded constructors for all extension objects that            // adhere to the ScriptableObject.defineClass() protocol            new LazilyLoadedCtor(global, "File",                    "helma.scripting.rhino.extensions.FileObject", false);            new LazilyLoadedCtor(global, "Ftp",                    "helma.scripting.rhino.extensions.FtpObject", false);            new LazilyLoadedCtor(global, "Image",                    "helma.scripting.rhino.extensions.ImageObject", false);            new LazilyLoadedCtor(global, "Remote",                    "helma.scripting.rhino.extensions.XmlRpcObject", false);            MailObject.init(global, app.getProperties());            // add some convenience functions to string, date and number prototypes            Scriptable stringProto = ScriptableObject.getClassPrototype(global, "String");            stringProto.put("trim", stringProto, new StringTrim());            Scriptable dateProto = ScriptableObject.getClassPrototype(global, "Date");            dateProto.put("format", dateProto, new DateFormat());            Scriptable numberProto = ScriptableObject.getClassPrototype(global, "Number");            numberProto.put("format", numberProto, new NumberFormat());            initialize();        } catch (Exception e) {            System.err.println("Cannot initialize interpreter");            System.err.println("Error: " + e);            e.printStackTrace();            throw new RuntimeException(e.getMessage());        } finally {            Context.exit();            if (debugger != null) {                debugger.contextExited(context);                debugger.contextReleased(context);            }        }    }