July 2013
Intermediate to advanced
370 pages
8h 27m
English
Of course, for some programmers nothing can give as much pleasure as getting into the command line and running the
program from there. We can do that by typing the command groovy followed by the Groovy
program filename, as shown next.
| | > cat Hello.groovy |
| | println "Hello Groovy!" |
| | > groovy Hello |
| | Hello Groovy! |
| | > |
To try a couple of statements directly on the command line, use the -e
option. Type groovy -e "println ’hello’" on the command line, and press
Enter/Return
. Groovy will
output “hello.”
Realistically, though, the groovy command is useful for executing large Groovy scripts and classes.
It expects us to either have some executable code outside any class, or have a class with a
static ...
Read now
Unlock full access