Nashorn engine is an open source implementation of the
ECMAScript Edition 5.1 Language Specification.
It also implements many new features introduced in ECMAScript 6
including template strings;
const, and block scope; iterators
WeakSet data types;
symbols; and binary and octal literals. It is written in Java and runs
on the Java Virtual Machine.
Nashorn used to be part of the JDK until Java 14. This project provides a standalone version of Nashorn suitable for use with Java 15 and later.
Nashorn is free software, licensed under GPL v2 with the Classpath exception, just like the JDK.
Making Nashorn standalone is still a work in progress. There is no standalone documentation for it yet. The best current documentation are Nashorn-related documents published by Oracle with Java 14:
- Nashorn User's Guide
- Java Scripting Programmer's Guide
- Nashorn API Specification (substitute
org.openjdk.nashornin place of
jdk.scripting.nashornmodule name and
Nashorn is a JPMS module, so make sure it and its transitive dependencies (Nashorn depends on several ASM JARs) are on your application's module path, or appropriately added to a module layer, or otherwise configured as modules.
Building From Source
Nashorn uses Ant as its build system.
cd make/nashorn ant jar
will download the dependencies and build the JAR file. Other notable targets are
test for running its own internal test suite, or
test262-parallel for running the official ECMA-262 test suite for ECMAScript 5.1. You will need to execute
ant get-test262 to download the tests into Nashorn's local test directory once.
Nashorn is a project under the charter of the OpenJDK. The OpenJDK Bylaws govern our work. The Nashorn project membership can be found on the OpenJDK Census. We welcome patches and involvement from individual contributors or companies. If this is your first time contributing to an OpenJDK project, you will need to review the rules on becoming a Contributor, and sign the Oracle Contributor Agreement (OCA).
If you think you have found a bug in Nashorn, first make sure that you are testing against the latest version - your issue may already have been fixed. If not, search our issues list in the Java Bug System (JBS) in case a similar issue has already been opened. More information on where and how to report a bug can be found at bugreport.java.com. Use component "Core Libraries" and Subcomponent "jdk.nashorn" when filing an issue.
Discussion of Nashorn development happens on the nashorn-dev mailing list.