Nashorn Makes JavaScript Shine in Java 8

  • Posted on : October 31, 2014
  • Author : SPEC INDIA
  • Category : Java

Based on Mozilla’s Rhino, Nashorn (a German term for Rhinoceros) is a modern JavaScript engine, included in the JDK8. It is developed in the Java programming language and is released with Java 8. It replaces Rhino as Java’s embedded JavaScript engine. Providing a direct integration with pure Java programs, Nashorn is something every Java developer, working on web applications has to learn and understand.

It supports the entire ECMAScript 5.1 specifications adding certain extensions. Owing to its salient features, it gives a performance boost as compared to the previous Rhino implementations. Rhino and Nashorn, both are straight implementations of the JavaScript language to be executed on the JVM.

Earlier, JavaScript was not that well known. It started gaining popularity on the client side of web applications and became an important language, which is why Java 8 chose to include the Nashorn JavaScript engine as a bundle, making it simple to run JavaScript with Java.

nashorn

What Nashorn looks for is the implementation of a lightweight JavaScript runtime in Java which is high performance and thereby, let the Java developers embed the JavaScript in Java applications. Java 8 has introduced a better version of the javac compiler – Nashorn. This new engine is intended to bring JVM to the front for speedy execution of JavaScript.

Salient Features of Nashorn

  • Support for javax.script API
  • Provision for direct mapping to JavaBeans
  • Definition of a new command line too, jjs, in order to evaluate the code in scripts and documents
  • Invoke Java code from JS and for Java to invoke JS code
  • Better performance and memory utilization as compared to Rhino
  • Proper functioning of the supplied libraries under localization
  • Standardization of error messages and documentation
  • Thorough adaptation of the ECMAScript-262 Edition 5.1 language specifications
  • Accurate security measures to avoid risks
  • Neat support for functional interfaces

Scope Limitations of Nashorn

Along with its benefits and features, there are certain areas which have not been adhered to.

  • Non-support to other features of Edition 6
  • Does not include a browser plug-in API
  • Missing debugging support (present in Rhino)
  • Non-inclusion of support for DOM/CSS and related libraries

But, there are certain turnaround solutions and APIs that work towards lessening the gap created because of these limitations and hence, Nashorn does not hinder the normal functioning of its developers but instead provides for a better experience and best of results. Nashorn does bring JavaScript to the forefront and makes it shine around with its features and capabilities. Way to go to experience the power of JS and Nashorn.

Author: SPEC INDIA


Leave a Reply

Your email address will not be published. Required fields are marked *

Guest Contribution

We are looking for industry experts to contribute to our blog section through fresh and innovative content.

Write For Us

Our Portfolio

Proven Solutions Across Industries
Technology for Real-Life

Visit Our Portfolio

Scroll Up