Kevin, Ive managed to get rid of that problem, but you know earlier you said NativeDate, where is this class defined? as i cant find it and my compiler wont allow it.
I got round the earlier problem by adding org.mozilla.javascript.ScriptableObject.defineClass(scope, DefaultJavascript.class); Regards Chris wade Ruland Kevin-BHP637 wrote: > Chris, > > I suspect the problem is with jsGet_printd, jsSet_printd. This > convinces JS that "printd" is a property with setters and getters. > Instead you should replace the two of them with jsFunction_printd which > defines "printd" as a method. > > Kevin > > -----Original Message----- > From: chris wade orange [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 10, 2008 11:13 AM > To: Ruland Kevin-BHP637 > Subject: Re: HELP adding javascript to a java applications > > Thanks for that, but I am still very confused, > > Here is my console output and I have attached my classes. > > Can you please tell me what i am missing. > > Thank you very much. > > Chris wade > > Ruland Kevin-BHP637 wrote: > >> Chris, >> >> There are two possible causes both related to type conversion. >> >> 1) Does util.printd have signature (String, NativeDate)? If not, JS >> might be trying to coerce the here. >> 2) Assignment to event.value. What is the signature of >> event.setValue( XX )? >> >> You can try inserting a \n char in the code string to see if the >> TypeError changes lines: >> >> Code = "event.value = \n util.printd("mmmm d, yyyy", new Date());" >> >> Kevin >> >> -----Original Message----- >> From: >> [EMAIL PROTECTED] >> dev-tech-js-engine-rhino-bounces+g >> [mailto:[EMAIL PROTECTED] >> zi lla.org] On Behalf Of chris wade orange >> Sent: Tuesday, June 10, 2008 9:39 AM >> To: [email protected] >> Subject: HELP adding javascript to a java applications >> >> I keep getting this warning and I cant figure out why. >> >> TypeError: Cannot find default value for object. (<cmd>#1) >> >> I get it with this code:- >> code = "event.value = util.printd("mmmm d, yyyy", new Date());"; >> >> Object testjs_event = org.mozilla.javascript.Context.javaToJS( testjs, >> > > >> scope ); >> org.mozilla.javascript.ScriptableObject.putProperty( scope, >> "event", testjs_event ); >> >> Object testjs_util = org.mozilla.javascript.Context.javaToJS( testjs, >> scope ); >> org.mozilla.javascript.ScriptableObject.putProperty( scope, >> "util", testjs_util ); >> >> Object result = cx.evaluateString(scope, code, "<cmd>", 1, null); >> >> >> The testjs is an object of class with these javascript methods in:- >> private int value = -1; >> public void jsConstructor(int inVal) >> public int jsGet_value() >> public void jsSet_setValue(int inVal) >> >> Can anyone shed any light on this situation please? >> >> Kind Regards all >> >> Chris wade >> >> _______________________________________________ >> dev-tech-js-engine-rhino mailing list >> [email protected] >> https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino >> >> >> >> > > > _______________________________________________ dev-tech-js-engine-rhino mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
