Project Nashorn: JavaScript’s Second Chance on the JVM

Notice: Undefined property: stdClass::$non_show_posts in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 48

Notice: Undefined property: stdClass::$aga_c234x60 in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 29

Notice: Undefined property: stdClass::$aga_c728x90 in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 31

Notice: Undefined property: stdClass::$aga_c120x600 in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 32

Notice: Undefined property: stdClass::$aga_c160x600 in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 33

Notice: Undefined property: stdClass::$aga_c120x240 in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 34

Notice: Undefined property: stdClass::$aga_c234x60 in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 29

Notice: Undefined property: stdClass::$aga_c728x90 in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 31

Notice: Undefined property: stdClass::$aga_c120x600 in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 32

Notice: Undefined property: stdClass::$aga_c160x600 in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 33

Notice: Undefined property: stdClass::$aga_c120x240 in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 34

Notice: Undefined variable: response in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 244

Notice: Undefined variable: content_end in /home/jamessug/public_html/wp-content/plugins/awesome-google-adsense/awesome-google-adsense.php on line 166

Throughout 2012, JavaScript seems to be solving problems across the industry, causing some justifiable hype across a number of libraries and frameworks. Oracle’s Project Nashorn was recently announced, due for release with Java 8 in late 2013, which will allow JavaScript to be embedded in Java applications and to develop standalone JavaScript applications.

It makes sense that the JVM maintains it’s relevance by providing an improved JavaScript engine: there have been indications that performance is up to five times faster than the current Rhino implementation and the engine footprint is five times smaller.

We spoke to Henrik Stahl, senior director of Java product management at Oracle to find out more.

DZone: Where did the motivation for Nashorn come from?

Henrik Stahl: Oracle recognizes that multi-language support is important to Java

The Rhino engine currently used is dated and not architected together with the JVM

Writing a new engine allows us to validate the Invokedynamic (JSR-292) feature in JDK 7, leverage all new language and JVM features in JDK 8, as well as provide a seamless way of using Javascript and Java code in the same program.

DZone: How long have Oracle been working on it internally?

Henrik: We have been working on Nashorn for the past year and a half.

DZone: Was it originally for any other purpose or products?
Henrik: No. The goals have remained the same since the project’s inception, although we have found ways to use it that we hadn’t originally anticipated; such as using it as a backend for the Javascript development and debugging features in Netbeans.

DZone: How much of Nashorn is already complete?

Henrik: The Nashorn engine is passing all ECMAScript 5.1 compliance tests. Early access users have been able to switch their application from Rhino to Nashorn without major issues.

DZone: And what still needs to be added?

Henrik: The team is currently focused on robustness and performance as well continuing to evaluate potential JVM optimizations. The team is also starting to explore support for upcoming ECMAScript 6.0 features.

DZone: Why do you think that Nashorn will be more successful than Rhino, the previous JS implementation on the JVM?

Nashorn significantly outperforms Rhino, and the gap will increase even more as we now move focus from spec compliance and stability to performance

Nashorn implements a new meta-object protocol that simplifies calling Java APIs from JavaScript, and enables seamless interactions between JavaScript and Java.

Nashorn enables infrastructure providers to consolidate their JavaScript and Java workloads on single virtual machine technology, and leverage the JVM management, debugging and profiling capabilities.