Nashorn A New JVM JavaScript
Nashorn A New JVM JavaScript
Written by Alex Armstrong   
Tuesday, 27 November 2012

Oracle has proposed a new OpenJDK project to create a fast and lightweight JavaScript engine running on the JVM. The Nashorn project, German for Rhino, is being voted on now.

The Rhino JavaScript engine, which is supported by Mozilla, already provides a Java implementation. It is written in Java and is often used to implement scripting within Java programs.  The new project aims to make use of the modern additions to Java to speed things up.



As the proposal says:

"we would like to start a new project to implement a lightweight high-performance JavaScript runtime in Java with a native JVM. This project intends to enable Java developers to embed JavaScript in Java applications via JSR-223  and to develop free standing JavaScript applications using the jrunscript command line tool."

Despite the obvious temptation to incorporate existing code into the new project, the intention is to start a new code base. Since Rhino things have moved on in Java's ability to support dynamic languages and API calls such as InvokeDynamic should result in faster and more reliable code without the memory leaks that plagued Rhino.

"The scope of this project will include, but is not limited to, a parser API for scanning JavaScript source code, a compiler to convert ASTs from the parser to JVM byte code, and a runtime to support the execution of said generated byte code."

The target version of JavaScript is ECMA-262 and ECMAScript 5.1.

Introduction to Nashorn


Oracle already has some code that it plans to share if the project is voted into existence. The vote is for current OpenJDK members and closed on December 6th.

Nashorn looks to be mainly a replacement for Rhino as a way of embedding scripting into Java programs. However, if it is as fast as promised, other JavaScript projects such as Node.js might consider its use.  JavaScript engines based on C/C++ are usually faster than even JIT-based JVMs, but the advantage in using a JVM based engine is the it is portable. Anywhere Java can run so can Rhino and soon Nashorn.

JavaScript still hasn't really managed to break out of its clientside habitat despite the growing success of Node.js. Perhaps Nashorn will provide ways to run JavaScript not only in Java projects but on the desktop, in the server and perhaps in even in the browser. After all, Java byte code is a lot more sensible a choice as the assembler for the web than JavaScript  - or is it?



More Information

Nashorn Proposal

Oracle Nashorn Blog

Related Articles

JSFeat - JavaScript Image Processing Library

Node: Up and Running

JavaScript Is Basic's Offspring

Which JavaScript is fastest?


To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, Facebook, Google+ or Linkedin,  or sign up for our weekly newsletter.



blog comments powered by Disqus



US Curtailing H-1B Visas For Computer Programmers

As the annual lottery for H-1B visas that enable US companies to recruit highly educated foreign workers to work in "speciality occupations" gets underway, a memo relating to computer programmer jobs  [ ... ]

Robots Learn To Navigate Pedestrians

Do you manage to walk a crowded street without bumping into people or having near misses as you try to pass? If so you probably learned how to do it in a very similar way to this socially aware robot, [ ... ]

More News

Last Updated ( Wednesday, 28 November 2012 )

RSS feed of news items only
I Programmer News
Copyright © 2017 All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.