Subj : Re: Calling a compiled script with arguments To : netscape.public.mozilla.jseng From : redcoat Date : Mon Dec 20 2004 12:23 pm Thanks! That's what I was missing. I've got everything running, but having problems with new objects being created unexpectedly... I'm using your code as follows: private Scriptable prepareExecScope(Scriptable sharedScope, Handler client) throws EvaluatorException, JavaScriptException, IllegalAccessException, InstantiationException, InvocationTargetException, ClassDefinitionException, PropertyException { Context cx = Context.enter(); try { Scriptable scope = cx.newObject(sharedScope); scope.setPrototype(sharedScope); scope.setParentScope(null); ScriptableObject.defineClass(scope, MFPHandler.class); Scriptable jsClient = cx.newObject(scope, "MFPClient"); scope.put("client", scope, jsClient); return scope; } finally { Context.exit(); } } The problem comes when I call the ScriptTest - I am passing in an MFPClient object that I have already instantiated, and want to use that, with it's member variables, with this particular script execution. However I see the MFPClient constructor getting called twice more, with the ScriptableObject.defineClass, and cx.newObject(scope, "MFPClient") calls. Thus the script calls an object that has none of the member variables set. Is there any way to have the script call an pre-instantiated java object, which has particular member variables before the script is run. Many thanks, David .