CHAPTER 5
Procedures and Compiled Scripts
In this chapter, you will learn:
- How to invoke procedures written in scripts from Java programs
- How to implement Java interfaces in Nashorn script
- How to compile Nashorn scripts and execute them repeatedly
Invoking Procedures in Scripts
In previous chapters, you have seen how to invoke scripts using the eval() method of the ScriptEngine. It is also possible to invoke procedures written in a scripting language directly from the Java program, provided the ScriptEngine supports procedure invocation.
A scripting language may allow creating procedures, functions, and methods. The Java Scripting API lets ...
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.