Paul Krill
Editor at Large

Oracle: Switch now from Nashorn JavaScript engine to GraalVM

news
Jul 20, 20182 mins

Oracle says GraalVM is more capable than Nashorn, and it has laid out a migration path from Nashorn to GraalVM

JVM - Java Virtual Machine
Credit: Thinkstock

With plans to deprecate the Nashorn JavaScript engine in the upcoming Java Development Kit (JDK) 11, Oracle is encouraging developers to take a look at GraalVM virtual machine instead. Oracle says it’s more capable than Nashorn, and it has laid out a migration path from Nashorn to GraalVM. Oracle does plan to support Nashorn for a few years to provide time to migrate.

Like Nashorn, GraalVM supports JavaScript on the JVM. But GraalVM is independent of Java itself.

Oracle cited multiple advantages GraalVM has over Nashorn:

  • A more complete implementation of JavaScript standards, with support for the ECMAScript 2016 and ECMAScript 2017 editions and some support for ECMAScript 2018.
  • Full support for the Node.js server-side JavaScript platform, which is compatibie with almost all Node.js modules.
  • The ability to execute additional languages including Python, R, and Ruby.
  • Better performance than existing JVM-based engines and ability to use the GraalVM compiler’s advanced optimizations.

To help developers migrate from Nashorn to GraalVM, Oracle Labs has added a compatibility flag (—nashorn-compat) that removes the need for tedious rewrites to move a Nashorn application to GraalVM.

A common polyglot API in GraalVM provides interoperability with supported languages. Values can be passed from one language to another. No copying or marshalling is necessary.

GraalVM can run either in the context of the JDK 8-based GraalVM installation or the standard JDK installation starting with JDK 11, which arrives in September. Although GraalVM will not be included with the JDK, it can run on a standard JDK 11 installation by adding it to the module path. GraalVM also can be embedded as part of platforms such as OpenJDK or Node.js, as well as within a database.

Where to download GraalVM

You can download GraalVM from the GraalVM webpage, which links to GitHub for the free Community Edition version and to the Oracle Technology Network for the paid Enterprise Edition version.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author