Sunday, November 30, 2008

Groovy and Grails

I knew that I would need something to occupy my time on a 9-hour road trip traveling home from a Thanksgiving holiday trip. Groovy and Grails are not part of what I am supposed to be learning for GIS and portlets, but after attending a Grails talk by Scott Davis at the NFJS symposium November 7, I thought it would be something easy and fun to learn. I had purchased "Beginning Groovy and Grails" by Judd, Nusairat, and Shingler for light reading during the times I was not able to get online. Before leaving on Sunday morning I downloaded groovy-1.5.7-installer.exe and had read enough of the introductory chapters in the book that I felt comfortable beginning the installation.

After being sufficiently bored with the scenery, I pulled out my Dell Inspirion and set to work. The book had a few basic steps in the installation section that involved just unzipping the download and modifying a couple of environment variables. Then the book said that you could test the installation by issuing the "groovy -version" command. I'm sure I could have handled doing that. But when I looked in the download folder I realized that what I had downloaded was the installer and not just the zipped binary. I'd have to trust that all the "automagic" stuff used by the installer would be done correctly.

First, of course, is that it wanted to install to C:\Program Files, which is not where I wanted it. The installer seemed to accept my choice of location. It also seemed to be completing successfully until it got to an "Additional Modules" screen where it hung up and the title bar on the window showed "Module Not Responding". Windows Vista has a habit of getting hung up and there wasn't much I could do but wait it out. The screen finally went away and the installation appeared to have finished. I opened a command prompt window to see if it could recognize the "groovy -version" command. Nope, couldn't find the command. Checking the environment variables, including the PATH variable, showed that they had been set correctly.

Next, I changed to the groovy\bin directory and then it found the command but gave an error

Unrecognized option: -version
error: jvm creation failed with code -1: unknown error

OK, maybe something didn't install correctly. I used the uninstall.exe program and then started the installer over again. This time it only hesitated momentarily at the "Additional Modules" screen. There was more displayed in that screen than what I had seen the first time. There were also additional screens after that one. It looked like an error in the first installation is what caused the problem.

Back to the command line to try again. Windows still couldn't find the groovy command. And when I changed to the groovy\bin directory it was the same error. Did anything install correctly? How about if I just issue the groovy command at the command line with no parameters? Isn't that supposed to tell you what parameters the command will recognize? Sure enough, just typing groovy gave a list of all the allowable parameters. And, look there, where it tells you how to find the version. The parameter for finding the version is -v, not -version! Great--all this struggle and it boils down to one of those deals where somebody changed something in the usage and it happened too fast for the book world to catch up. We still don't know why Windows won't recognize the path to groovy that is in the PATH variable. Maybe that will clear up next time I reboot.

No comments: