Goals of Nashorn
Laskey described his goals for Nashorn as follows:
- Nashorn will be based on the ECMAScript-262 Edition 5.1 language specification and must pass the ECMAScript-262 compliance tests.
- Nashorn will support the
javax.script(JSR 223) API.
- Nashorn will define a new command-line tool,
- Performance and memory usage of Nashorn applications should be significantly better than Rhino.
- Nashorn will not expose any additional security risks.
- Supplied libraries should function correctly under localization.
- Error messages and documentation will be internationalized.
Laskey also explicitly limited the scope of the project with some "non-goals":
- Nashorn will not include a browser plug-in API.
- Nashorn will not include support for DOM/CSS or any related libraries (such as jQuery, Prototype, or Dojo).
- Nashorn will not include direct debugging support.
So what does it mean to be based on ECMAScript-262 Edition 5.1? The differentiator here is that Rhino was based on the older, less capable Edition 3. The
Nashorn command-line tools
After reading about
jjs, I was eager to try out the shell on my iMac, but after installing Java 8 it wasn't available to the bash shell. It turns out the documentation and implementation weren't completely in sync.
I knew the installation had been successful:
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
-bash: jjs: command not found. A little poking around brought me to the
There I found something called
jrunscript, which turned out to be a variant of
jjs that runs an extra startup script. That should have satisfied me, but I was puzzled as to why the documented
jjs tool wasn't installed in
/usr/bin/ with the rest of the Java 8 runtime. A little research led me to look at the JavaVirtualMachines installation for Java 8. On a Mac, look for
You can define an alias for
jjs in the latter directory and add it to your shell configuration if you need it for scripting on a Mac or Linux. On a PC, you can add the correct
jre/bin/ directory to your PATH. In his video from the Java 8 launch, Jim Laskey suggests copying
jjs to the
/usr/bin/ directory, but when I did that I found that
jjs couldn't find the
jre properly at runtime.