Monday, April 22, 2013

Groovy Tutorial Pt 1.9

Installing Groovy

Java Prereq

To do real applications you'll need to install Groovy and Java on your machine. Go here to get Java 1.7 SE (Standard Edition) SDK (Software Developers Kit) and download an appropriate version. I am running Windows 7 so I'll use the highlighted one. If you don't know which one to get, ask Google. Just so you know, the JDK refers to Java Developers Kit, and GDK is Groovy Developers Kit. It's not rocket science.
Follow the installer to do all standard settings. It will install a few different tools, most of which you won't use, hence, we won't talk about them.

Get Your Groove On

Next, go here and download the latest binary of Groovy. For this, I'll be using 2.1.3.

You can also use the installer, but I'll be dealing with the binary for generalized instructions. Once you've downloaded the binary you're going to unzip the contents into a file location. Mine is going to go into "C:\Program Files\Java". Right Click on the zip in your downloads folder and extract to a directory.
If you have any trouble, just use the "extract to here" menu option and copy the files to your directory of choice. Here's my groovy install:


Next, you'll need to set your environment variables to find the location of the Groovy install. Edit the system environment variables and add GROOVY_HOME and JAVA_HOME to point to your SDK's. Follow the snapshots below.
If you pull up the start menu you can search for environment settings, otherwise go to the Control Panel and look for menus that will let you to editing these properties.

You'll have to add these one by one, and remember the "Variable value" is the path to your specific installation. If you extracted the zip file into the downloads folder, you'll have to point there. Lastly, you should have a "Path" system variable already defined. Edit that variable and add on "%groovy_home%%\bin;%java_home%\bin". Every variable is denoted by % signs and are separated with a semicolon. The \bin folder is where all your executable files (called binaries) are, that why you have to add it to the Path variable.

Now, open up your command line (cmd.exe) and check your installation details. Your commands should show the same kind of output that mine does. If it does not show the same output, something went wrong and you should ask Google or give me a comment below and I'll try to help.


For the grand finale, enter "groovyConsole" into the command line.


This little sucker is going to be your best friend. From here on out we'll be using this to write pilot code and develop an app. Later on we'll probably move to full scale IDE so that you can send your app to all your friends.

Checkpoint: Go ahead and run a few commands from the previous tutorial to make the Groovy Console an acquaintance.

No comments:

Post a Comment