Chapter 3. Code-level integration

This chapter covers

  • Calling Groovy scripts from Java using JSR 223
  • Calling Groovy scripts from Java using Groovy library classes

In chapter 1 I reviewed many of Java’s arguable weaknesses and drawbacks and suggested ways that Groovy might help ameliorate them. Because that chapter was intended to be introductory, I only suggested how Groovy can help, without showing a lot of code examples.

This chapter begins an examination of Java and Groovy integration in detail. In this chapter I’ll start using Groovy and Java together in fundamental ways, without worrying about frameworks or addressing any particular use case. A guide to the techniques discussed in this chapter is shown in figure 3.1.

Figure 3.1. ...

Get Making Java Groovy 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.