The interpreter runs on the JVM and executes programs written in the source
• The source language ships with a compiler that produces class files from units
of source language code.
The resulting compiled class files are then directly executed on the JVM, usu‐
ally with some additional language-specific runtime support.
Nashorn takes the second approach—but with the added refinement that the com‐
ten for Nashorn can still be easily deployed on the platform.
Nashorn is unlike many other JVM languages (such as JRuby)
in that it does not implement any form of interpreter. Nashorn
This is interesting, from a technical perspective, but many developers are curious as
to what role Nashorn is intended to play in the mature and well-established Java
ecosystem. Let's look at that role next.
Nashorn serves several purposes within the Java and JVM ecosystem. Firstly, it pro‐
JVM. Second, it enables companies to continue to leverage their existing investment
guage. Last, it provides a great engineering showcase for the advanced virtual
machine technology present in the HotSpot Java Virtual Machine.
ditional home in the browser to more general-purpose computing and the server
side, Nashorn represents a great bridge between the existing rock-solid Java ecosys‐
tem and a promising wave of new technologies.
For now, let's move on to discuss the mechanics of how Nashorn works, and how to
code can be executed on Nashorn, and in the next section we'll look at two of the
most commonly used.
In this section, we'll be introducing the Nashorn environment, and discuss two dif‐
tory of $JAVA_HOME ):