CHAPTER 6

image

Using Java in Scripting Languages

In this chapter, you will learn:

  • How to import Java classes into scripts
  • How to create Java objects and use them in scripts
  • How to call overloaded methods of Java objects
  • How to create Java arrays
  • How to extend a Java class and implement Java interfaces in scripts
  • How to invoke superclass methods of an object from scripts

Scripting languages allow using Java class libraries in scripts. Each scripting language has its own syntax for using Java classes. It is not possible, and is outside the scope of this book, to discuss the syntax of all scripting languages. In this chapter, I will discuss the syntax ...

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.