These instructions describe how to install a binary distribution of Groovy.
- first, Download a binary distribution of Groovy and unpack it into some file on your local file system
- set your GROOVY_HOME environment variable to the directory you unpacked the distribution
- add GROOVY_HOME/bin to your PATH environment variable
- set your JAVA_HOME environment variable to point to your JDK. On OS X this is /Library/Java/Home, on other unixes its often /usr/java etc. If you've already installed tools like Ant or Maven you've probably already done this step.
You should now have Groovy installed properly. You can test this by typing the following in a command shell:
Which should create an interactive groovy shell where you can type Groovy statements. Or to run the Swing interactive console type:
To run a specific Groovy script type:
Alternative Installation on Mac OS X
Set up MacPorts
Open Terminal
Labels
2 Comments
Hide/Show CommentsDec 01, 2005
John Riedl
If you want to call Groovy classes from Java you'll also need to add the Groovy libraries to your Java CLASSPATH. (The Groovy binaries will do this automatically when you run one of the Groovy bin commands, like groovysh, but you won't be doing that if you're calling Groovy from java.)
There are a flock of jars that you need ... but Groovy has conveniently gathered them all into one convenient jar in the embeddable directory of the binary distribution. Just add that jar to your classpath and you're all set to groove. (The jar in the 1.0-jsr-04 distro is called groovy-all-1.0-jsr-04.jar.)
Enjoy,
John
Apr 21, 2008
Paul King
Trailing slashes will be automatically removed in 1.5.6 due out around the end of this week.