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: Foreword by Guillaume Laforge now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.