In this recipe, we will provide instructions on installing the Groovy distribution on the Windows operating system.
The requirement for installing Groovy 2.0 is JDK 1.5 and higher. We assume that you have JDK installed and know how to use Java. In case you use JDK 7 or later, then you can take advantage of the dynamic language optimization present in that version. For instance, the invokedynamic
bytecode instruction (see the Running Groovy with invokedynamic support recipe).
To install Groovy on Windows, you need to download the ZIP distribution from http://groovy.codehaus.org/Download.
The latest major version at the time of writing is 2.1.6. The latest minor version is 2.0.8. Since v2.0, Groovy has changed the release version numbering, so the next major version of Groovy will be 3.0 and the next minor versions will have the second digit increased (2.1, 2.2, 2.3, and so on).
Alternatively, you can build Groovy from the source distribution which is described in the Building Groovy from source recipe.
After downloading the zipped distribution, you need to unzip the archive to a directory of your choice and carry out the following steps to install Groovy on Windows:
C:Applicationsgroovy-2.0
. The contents of the directory should look as shown in the following screenshot:groovy
command available on your command line, you need to add it to your system's path by setting the environment variable named PATH
. We also advise you to create a GROOVY_HOME
variable for simpler reference.GROOVY_HOME
variable pointing to your Groovy installation path:Path
variable in the list of system variables and append or insert the %GROOVY_HOME%in;
string to it:groovy --version
command:If you get the output displayed as in the previous screenshot, your Groovy installation is complete.