Skip to main content

Nashorn Project Proposed for OpenJDK (Planned for Inclusion in Java 8)

Posted by editor on December 1, 2012 at 9:13 PM PST

During a JavaOne 2012 keynote, I scribbled down a list of key enhancements that are planned for inclusion in Java 8. Among them was Nashorn. At the time, I didn't know much about Nashorn. But, now that John Coomes has formally proposed the creation of an OpenJDK New Project: Nashorn, it seems appropriate to take a closer look.

Nashorn has sufficient visibility to have a brief Wikipedia entry, and we've been highlighting Nashorn news on recently, including Geertjan Wielenga's NetBeans experiments with Embedded Nashorn in JEditorPane.

But, as you read this, you may be (like I was at JavaOne) wondering exactly what this "Nashorn" is. Wikipedia's overview is:

Nashorn is an upcoming JavaScript engine, developed fully in the programming language Java by Oracle Corporation. It is based on the Da Vinci Machine (JSR 292) and will be available for Java 8 in late 2013.

JSR 292 is titled "Supporting Dynamically Typed Languages on the JavaTM Platform"; it's led by John Rose, and both John Rose and JSR 292 won JCP Awards in 2011.

The message from John Coomes states that JSR 223 is also involved:

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.

But there's much more. Here's a relevant snippet:

In particular the project will utilize the MethodHandles and InvokeDynamic APIs described in JSR-292. The goal is to provide a lightweight high performance JavaScript on a native JVM. 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. Execution of JavaScript in this environment will be in conformance with ECMA-262 Edition 5.1 and will adapt to newer guidelines as standards evolve.

So, we may have lost implementation of Project Jigsaw in Java 8. But, aren't Project Nashorn and Project Lambda (closures) enough in themselves to make Java 8 a pretty significant Java major release?

You can learn more about Nashorn in Jim Laskey's presentation Adventures in JSR 292 (Nashorn).


Our latest article from Manning Publications is Defining Functional Data Structures by Paul Chiusano and R

Related Topics >>