I have evaluated the following script using the NashornScriptEngine
:
var Namespace = {
test: function()
{
return "It works";
}
}
Now I want to call the function test
.
When using the method invokeFunction
of the nashorn engine, the following exception is thrown:
java.lang.NoSuchMethodException: No such function Namespace.test
How is it possible to call this function?