Dashboard > Groovy > ... > Quick Start > Installing Groovy
Installing Groovy Log In | Sign Up   View a printable version of the current page.

Added by James Strachan , last edited by Paul King on Jul 07, 2007  (view change)
Labels: 
(None)

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:

groovysh

Which should create an interactive groovy shell where you can type Groovy statements. Or to run the Swing interactive console type:

groovyConsole

To run a specific Groovy script type:

groovy SomeScript.groovy

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

As mentioned here http://article.gmane.org/gmane.comp.lang.groovy.user/30428 it is important, to omit trailing slashes in the GROOVY_HOME environment variable. Otherwise you will get strange errors like:

java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException

Have fun,
Simon

Trailing slashes will be automatically removed in 1.5.6 due out around the end of this week.

Site running on a free Atlassian Confluence Open Source Project License granted to The Codehaus. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.6.2 Build:#919 Nov 26, 2007) - Bug/feature request - Contact Administrators