Java Reference
In-Depth Information
Appendix A. Installing Groovy
InstallingGroovyiseasy.Thisappendixshowsyouhowtodoit,withareviewofthevarious
options involved.
A.1. Installing a JDK
Groovy generates Java bytecodes that are interpreted by a Java virtual machine. This means
you have to have Java installed in order to install Groovy. You need a full Java Development
Kit (JDK), rather than a Java Runtime Environment (JRE). You only need the Standard Edi-
1
Just as an aside, when did the word
business
get deprecated in favor of the word
enterprise
? Is it a
Star Trek
thing?
Does being an Enterprise Architect mean you design starships for a living? Are Enterprise Java Beans used when
making coffee on a starship?
The official JDK for Java SE is available from Oracle at
http://mng.bz/83Ct
. At the time of
this writing, the current version is Java SE 7u25 (Java 7, update 25), but Groovy works on
any version of Java 1.5 and above.
Be sure to set an environment variable called
JAVA_HOME
to point to the installation dir-
ectory. You also probably want to add the bin folder under
JAVA_HOME
to your path.
On Windows that will look like this:
C:\> set JAVA_HOME="C:\Program Files\Java\jdk1.7.0"
C:\> set PATH=%JAVA_HOME%\bin;%PATH%
Those commands will set the
JAVA_HOME
and
PATH
properties in the local shell. To set
them everywhere, right-click My Computer, select Properties, click Advanced, and then
2
The specifics of the process will be slightly different on different Windows versions, but the concepts are the same.
Set the variables as System environment variables, and start a new shell because Windows won't update an existing
one.