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.

 

nashorn

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?

 

nashorn

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

 

Banner


ShellShock - Yet Another Code Injection Vulnerability
25/09/2014

A vulnerability in the Bash shell has the Internet in full alarmed mode and like all good security holes it even has a catchy name - Shell Shock. How does it work?



Delve and Office Graph at SharePoint Connect
14/10/2014

 Following the release of Delve for Office 365, this year’s SharePoint Connect conference has added a session on building solutions with Office Graph. You can also earn CPD certification for at [ ... ]


More News

Last Updated ( Wednesday, 28 November 2012 )
 
 

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