Oracle Adds Nashorn Support in Java-Based GraalVM

The GraalVM team at Oracle Labs has announced new support in the polyglot virtual machine for users of the Nashorn JavaScript engine. Specifically, they're adding a Nashorn compatibility flag to make migration easier.

Version 1.0 of the GraalVM was announced in April of this year. Billed as a "universal virtual machine," it's designed to run applications written in a range of languages, including JavaScript, Python, Ruby, and R; JVM-based languages, such as Java, Scala, and Kotlin; and LLVM-based languages such as C and C++.

Graal is the Java-based JIT compiler (JEP 317) that is the basis of the experimental Ahead-of-Time (AOT) compiler introduced in JDK 9. Nashorn was released with Java 9 as a lightweight, high-performance JavaScript runtime. It was designed for Java developers embedding JavaScript in their applications via JSR 223.

"GraalVM's support for JavaScript and Node.js are a great path forward for applications that have been using Rhino or Nashorn in older versions of the JDK with more features, compatibility and performance," said Oracle Labs manager Christian Wirth in a post on Medium. "It is a totally different implementation than Nashorn, so there are likely some minor incompatibilities. Luckily, Nashorn will still be supported for a few years, so there is time for migration to the GraalVM JavaScript implementation before the Nashorn deprecation becomes a reality."

Oracle proposed deprecating Nashorn in June via JEP 335. In the motivation section of the JEP's description, Jim Laskey, Oracle's Director of Software Development, noted that the Nashorn JavaScript engine was first incorporated into JDK 8 via JEP 174 as a replacement for the Rhino scripting engine. At the time of its initial release, it was a complete implementation of the ECMAScript-262 5.1 standard.

"With the rapid pace at which ECMAScript language constructs, along with APIs, are adapted and modified, we have found Nashorn challenging to maintain," Laskey explained.

Two versions of GraalVM are currently available: a free community edition and a commercial enterprise edition. The free version was built from the GraalVM sources available on GitHub, and is available for development and production use. The Enterprise Edition is designed for running critical applications in production, and comes with additional performance, security, and scalability features.

Oracle Labs is the post-acquisition Sun Microsystems Laboratories, and the only organization at the company solely devoted to research. Its researchers "look for novel approaches and methodologies, often taking on projects with high risk or uncertainty, or that are difficult to tackle within a product-development organization," the company says on its Web site.

About the Author

John K. Waters is the editor in chief of a number of sites, with a focus on high-end development, AI and future tech. He's been writing about cutting-edge technologies and culture of Silicon Valley for more than two decades, and he's written more than a dozen books. He also co-scripted the documentary film Silicon Valley: A 100 Year Renaissance, which aired on PBS.  He can be reached at [email protected].