What objects are available in jjs?

173 views Asked by At

When I am running Javascript in a browser I have the document object available to me.

For instance, I can do document.write() in javascript in a browser.

The document object is not available when I am running Javascript under the Java 8 Javascript engine jjs.

jjs is a the successor to Rhino and is delivered with Java 8 from Oracle.

What objects are available in jjs? Where are they documented?

1

There are 1 answers

1
Karl-Johan Sjögren On BEST ANSWER

The document won't be available when running via Nashorn/jjs since it doesn't have a DOM (like a javascript engine in a browser would), the same goes for window. In other aspects it should implement ECMASCRIPT 5.1 but according to this blog post from Oracle it also lacks the console object which is a shame.

I haven't seen to much documentation about other stuff missing from the engine but there are a few pages which might be worth looking into over at the OpenJDK Wiki for Nashorn.