CHAPTER 12

image

Java APIs for Nashorn

In this chapter, you will learn:

  • What Java APIs for Nashorn are
  • How to instantiate the Nashorn engine directly
  • How to pass options to the Nashorn engine in Java code and on the command-line
  • How to share globals among script contexts in a Nashorn engine
  • How to add, update, delete, and read properties of script objects in Java code
  • How to create script objects and invoke their methods in Java code
  • How to invoke script functions from Java code
  • How to convert script dates to Java dates

What Are Java APIs for Nashorn?

It is straightforward to use Java classes in Nashorn scripts. Sometimes you may want to use Nashorn ...

Get Scripting in Java: Integrating with Groovy and JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.