Hi,
I just started with the Rhino and it's samples.
I'm trying to run the enum.js that comes with the examples and
contains the following:
var array = [0, 1, 2];
// create an array enumeration.
var elements = new java.util.Enumeration({
index: 0,
elements: array,
hasMoreElements: function() {
return (this.index < this.elements.length);
},
nextElement: function() {
return this.elements[this.index++];
}
});
// now print out the array by enumerating through the Enumeration
while (elements.hasMoreElements())
print(elements.nextElement());
I can run it with the shell but when trying to use the:
cx.evaluateReader(scope, new FileReader("enum.js"), "enum.js", 1,
null);
I get the following error:
Exception in thread "main" org.mozilla.javascript.EcmaError:
ReferenceError: "print" is not defined.
Is that the right way to run js files? or should I use another way?
Where can I see examples how to run compiled javascript files from a
java program?
Thanks In advance!
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino