I have a reference of a ScriptableObject inside a JavaScript which is in the IE’s context and not Rhino’s.


Trying to access a property out of the object as follows works.

scrObj.getProperty(scrObj, "objectProperty");


But trying to call a method as follows, doesn’t work

scrObj.callMethod(scrObj, "objectMethod", null);


I get an exception java.lang.nullPointerException.


1. From the documentation of ScriptableObject, I see that I must pass a Java object in the place I passed null during the callMethod, but I don’t know how to get an instance of a Java object from inside JavaScript.


2. Also, how do I access ScriptableObject class inside JavaScript? There are a lot of static methods that I am currently accessing as instance methods (for example getProperty).


Is there any good documentation on how to use ScriptableObject in JavaScript I can refer?