Subj : Making wrapped Java objects available in the application scope To : netscape.public.mozilla.jseng From : Frank Thater Date : Tue Jan 18 2005 07:27 pm Hi! I want to use the wrapAsJavaObject()-method to make my Java classes available in the rhino scripting runtime. My code looks like this: Scriptable wrappedByteString = scriptContext.getWrapFactory().wrapAsJavaObject(scriptContext, app, <-- this is the application scope new ByteString(), ByteString.class); How can i make this new class available for the script application, e.g. that someone can use something like 'var f = new ByteString()'? Formerly i used the the "defineClass()" method to register this class in the application context. But that was quite boring... Is there something similar i have to do? If i try to create a new object in my script i get the following exception: org.mozilla.javascript.EvaluatorException: Constructor for "ByteString" not found. at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:64) at org.mozilla.javascript.Context.reportRuntimeError(Context.java:815) at org.mozilla.javascript.Context.reportRuntimeError(Context.java:870) at org.mozilla.javascript.Context.reportRuntimeError1(Context.java:834) at org.mozilla.javascript.ScriptRuntime.getExistingCtor(ScriptRuntime.java:927) at org.mozilla.javascript.Context.newObject(Context.java:1360) But the construcor is in the class and public. Do you have some example source codes? Am i missing something? Thanks for your support. Kind regards, Frank .