Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

The Groovy command line (groovy or groovy.bat) is the easiest way to start using the Groovy Language.

$ groovy -help
usage: groovy
 -c,--encoding <charset>   specify the encoding of the files
 -e <script>               specify a command line script
 -h,--help                 usage information
 -i <extension>            modify files in place
 -n                        process files line by line
 -p                        process files line by line and print result
 -v,--version              display the Groovy and JVM versions
 -w <port>                 process socket i/o

If you have a groovy script, you can edit and run the script immediately.

$ cat test.groovy 
println 'Hello Bonson'

$ groovy test.groovy 
Hello Bonson

However you can also run such a simple groovy program by providing the script in the command line arguments.

$ groovy -e "println 'Hello Bob'"
Hello Bob

...more to come...

  • No labels