Using groovyConsole

Groovy has those of us who prefer to use a GUI covered—simply double-click groovyConsole.bat in Windows Explorer (look for it in the %GROOVY_HOME%\bin directory). Users of Unix-like systems can double-click the groovyConsole executable script using their favorite file/directory-browsing tool. We can also type groovyConsole on the command line to bring up the console GUI tool. A console GUI will pop up, as shown in the following figure.

Let’s type some Groovy code in the top window of the console. When ready to execute the code, press Ctrl+R or Ctrl+Enter on a Windows system, or Command+R or Command+Enter on a Mac system.

We can also click the appropriate toolbar button to execute the script. The groovyConsole command has ...

Get Programming Groovy 2 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.