Java 6 introduced the Java scripting application programming interface (API) in the package javax.script. It contains a script engine (or interpreter) to evaluate scripts. The scripts can be written in languages such as Rhino JavaScript, Groovy, Jython, or JRuby.
This book is a documentation of the Nashorn script language, which was introduced in Java 8 (Nashorn is the German word for rhino). The link between Java and JavaScript is reciprocal: Java can interpret JavaScript and JavaScript can use Java classes.
The first part of the book describes the advantages of using the Java scripting API and contains examples of executing scripts in Java. The source code is available for download. The largest part of the book describes the Nashorn scripting language. The language is fully compatible with JavaScript, but contains other new elements. It also allows Java to use the functions declared in the scripting language. The next part shows how to use Java classes in a Nashorn script.
The last chapters are about the command-line tools, integrating with JavaFX (the new Java graphical user interface (GUI) library intended to replace Swing), and debugging techniques.
The book is well organized and rich in information. It is not intended for beginners to scripting, but for developers who have a good understanding of the various scripting languages and the relation between Java and JavaScript.