Every Flavour Beans

“The time has come…to talk of many [technologies].” –Lewis Carroll(’The Walrus and the Carpenter’)
Development Tools. Web Frameworks. GNU/Linux. Nokia N800. Video Encoding.

June 15, 2008

Setting Up Development Environment For Grails on Windows Vista/XP

Filed under: Groovy/Grails, Web — tabrez @ 3:49 pm

Just as Ruby on Rails started to get wide publicity in the media for providing a surprisingly productive web application development framework, many people using other web development technologies suddenly started to wonder if their environment is missing something. Some introspection later, while some tried to add more productive features to their favourite technologies, some others went ahead and committed themselves to create a Ruby on Rails like framework for their own favourite programming language or platform. Where frameworks like TurboGears, Django come close to the model of Ruby on Rails and provided an excellent alternative for the Python programmers, one framework that comes the closest, in my opinion, is the Grails framework, and what good news it is for the Groovy and Java guys looking for an alternative way of developing web applications.

While Grails may yet lack the complete feature set and level of support available for the Ruby on Rails framework, it is very much a stable framework now and currently used by many websites in production environment. Below is the procedure to get everything needed to start creating web applications in Groovy using the Grails framework.

  1. Download and install the latest version of Java SE(currently JDK 6 update 6).
    Skip to the next step if you plan to use NetBeans or some other IDE. If you want to work with a text editor and the command prompt, you need to set the following environment variables:
    Go to Control Panel -> System -> Advanced System Settings and click the “Environment Variables” button. (Or Control Panel -> System, select the Advanced tab and click the “Environment Variables” button if you are using Windows XP).

    Add the path to Java bin directory to the system PATH variable.
    Add a new system environment variable called JAVA_HOME and set it to the path to your Java installation directory.
    Set Java environment variables in Windows
    For more details, refer to Sun’s instructions on how to install Java SE.

  2. Download and install the latest stable version of the Groovy windows installer(currently 1.5.6).
    Download the latest stable version of Groovy windows isntaller
    Make sure that you install Groovy to a path that doesn’t contain any spaces in it; so you need to remember to change the default path in the installer from “C:\Program Files\Groovy” to something like “C:\groovy”. Also make sure that you select the checkboxes to add Groovy’s directories to system environment variables.
    Select install path for Groovy that contains no spaces in it
    Select install path for Groovy that contains no spaces in it
    Select environment variables to be created by the Groovy windows installer

    For all the other settings, you can just accept the defaults. To confirm that Groovy is installed and all the environment variables are properly set, run the following command in the command prompt:

    C:\> groovy -v
    Groovy Version: 1.5.6 JVM: 10.0-b22

    If you get an error instead, carefully check again that the environment variables PATH and GROOVY_HOME are properly set.

  3. Repeat the similar process with the Grails installer: Download the latest stable version of the Grails installer and run it.
    Download the latest stable version of Grails Windows Installer
    Unlike the Groovy installer, Grails installer doesn’t create any environment variables, so we have to create them manually. Create a new environment variable called GRAILS_HOME and set it to the Grails installation path.
    Set Grails HOME environment variable in Windows
    Also add Grails’s bin directory to the PATH system environment variable:
    PATH=%JAVA_HOME%\bin;%GROOVY_HOME%\bin;%GRAILS_HOME%\bin

    To make sure that Grails is installed and the environment variables are set properly, run the following command:

    C:\Users\tabrez>grails -v

    Welcome to Grails 1.0.2 - http://grails.org/
    Licensed under Apache Standard Li
    Grails home is set to: C:\grails

  4. Now proceed to the next part of this tutorial and create an example “Hello World” web application using Grails framework to validate your Grails installation on Windows operating system.


If you want to receive future posts by email, enter your email address here:

Related Posts:

  • Creating “Hello World” Web Application Using the Grails Framework
  • Setting Up Development Environment For Grails on GNU/Linux
  • Installing Grails in Ubuntu GNU/Linux Using Package Manager
  • Setting Up Rails Development Environment using Aptana Studio
  • Setting Up Rails Development Environment on Fedora GNU/Linux
  • Setting Up Rails Development Environment on Ubuntu GNU/Linux
  • Setting Up Ruby on Rails Projects with Git and Github

  • Readers who viewed this page, also viewed:


    8 Comments »

    1. [...] have covered the installation procedure of Grails framework in my previous post: Setting Up Development Environment For Grails on Windows Vista/XP Once again, just to make sure, check out if the following environment variables are set properly on [...]

      Quote

      Pingback by Creating “Hello World” Web Application Using the Grails Framework — June 19, 2008 @ 4:56 pm

    2. I as of yet been able to get Grails to work, no matter how many times I reinstall and set the paths….

      Quote

      Comment by Anonymous — June 22, 2008 @ 3:08 pm

    3. Can you paste the output of ’set’ command somewhere(e.g. rafb.net/paste) and provide the link here? Open the command prompt and run the set command in it. I am pasting part of the output generated on my machine. Notice the paths set for JAVA_HOME, GROOVY_HOME, GRAILS_HOME and also the paths included in PATH variable.

      C:\> set
      ALLUSERSPROFILE=C:\ProgramData
      APPDATA=C:\Users\tabrez\AppData\Roaming
      APR_ICONV_PATH=C:\Program Files (x86)\Subversion\
      CLASSPATH=.;C:\Program Files (x86)\Java\jdk1.6.0_
      6)\Java\jre1.6.0_06\lib\ext\QTJava.zip
      CommonProgramFiles=C:\Program Files\Common Files
      CommonProgramFiles(x86)=C:\Program Files (x86)\Co
      COMPUTERNAME=TABREZ-PC
      ComSpec=C:\Windows\system32\cmd.exe
      DFSTRACINGON=FALSE
      FP_NO_HOST_CHECK=NO
      GRAILS_HOME=c:\grails
      GROOVY_HOME=C:\groovy
      HOMEDRIVE=C:
      HOMEPATH=\Users\tabrez
      JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_06
      [...]
      Path=c:\ruby\bin;C:\Windows\system32;C:\Program Files (x86)\MySQL\MySQL Server 5.0\bin;C:\Program Files (x86)\Subversion\bin;C:\Program Files (x86)\Java\jdk1.6.0_06\bin;C:\groovy\bin;c:\grails\bin;

      You can also try to see if proper version information is printed by running java -v, groovy -v and grails -v commands. If all the paths are set properly, what error do you get when you try to create a grails application?

      Quote

      Comment by tabrez — June 22, 2008 @ 3:32 pm

    4. [...] couple of my previous posts, I have explained how to install Grails and required packages to get a Grails development environment on the Windows platform. Continuing the Grails series, the current post explains how to set up a development environment [...]

      Quote

      Pingback by Setting Up Development Environment For Grails on GNU/Linux — July 10, 2008 @ 2:34 pm

    5. Setting Up Development Environment For Grails on GNU/Linux on July 10, 2008 at 2:34 pm said:

      [...] couple of my previous posts, I have explained how to install Grails and required packages to get a Grails development environment on the Windows platform. Continuing the Grails series, the current post explains how to set up a development environment [...]

      Setting Up Development Environment For Grails on GNU/Linux on July 10, 2008 at 2:34 pm said:

      [...] couple of my previous posts, I have explained how to install Grails and required packages to get a Grails development environment on the Windows platform. Continuing the Grails series, the current post explains how to set up a development environment [...]

      hi,

      i have tried many times to install grails and groovy but at command prompt , the command grails is not reocgnized here is my path details
      Microsoft Windows XP [Version 5.1.2600]
      (C) Copyright 1985-2001 Microsoft Corp.

      C:\Documents and Settings\Babar Rehman>groovy -v
      Groovy Version: 1.5.6 JVM: 11.0-b12

      C:\Documents and Settings\Babar Rehman>grails -v
      ‘grails’ is not recognized as an internal or external command,
      operable program or batch file.

      C:\Documents and Settings\Babar Rehman>set
      ALLUSERSPROFILE=C:\Documents and Settings\All Users
      APPDATA=C:\Documents and Settings\Babar Rehman\Application Data
      CLASSPATH=.;C:\Program Files\Java\jre1.6.0_03\lib\ext\QTJava.zip
      CLIENTNAME=Console
      CommonProgramFiles=C:\Program Files\Common Files
      COMPUTERNAME=COMPAQ
      ComSpec=C:\WINDOWS\system32\cmd.exe
      DISPLAY=:0.0
      FP_NO_HOST_CHECK=NO
      GRAILS_HOME=C:\Grails
      GROOVY_HOME=C:\Groovy
      HOME=C:\Documents and Settings\Babar Rehman
      HOMEDRIVE=C:
      HOMEPATH=\Documents and Settings\Babar Rehman
      JAVA_HOME=C:\Program Files\Java\jdk1.6.0_10
      LOGONSERVER=\\COMPAQ
      NUMBER_OF_PROCESSORS=1
      OS=Windows_NT
      PATH=C:\Program Files\Java\jdk1.6.0_10\bin;C:\Groovy\bin;C:\Grails\bin;
      PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.groovy;.gy;.groovy;.gy
      ;.groovy;.gy
      PCTYPE=PRESARIO
      PGLOCALEDIR=C:\Program Files\PostgreSQL\8.3\share\locale
      PLATFORM=MCD
      PROCESSOR_ARCHITECTURE=x86
      PROCESSOR_IDENTIFIER=x86 Family 15 Model 44 Stepping 2, AuthenticAMD
      PROCESSOR_LEVEL=15
      PROCESSOR_REVISION=2c02
      ProgramFiles=C:\Program Files
      PROMPT=$P$G
      QTJAVA=C:\Program Files\Java\jre1.6.0_03\lib\ext\QTJava.zip
      ROOTDIR=C:\PROGRA~1\RATIONAL\RATION~1\NUTCROOT
      SESSIONNAME=Console
      SHELL=C:\PROGRA~1\RATIONAL\RATION~1\NUTCROOT\mksnt\sh.exe
      SonicCentral=C:\Program Files\Common Files\Sonic Shared\Sonic Central\
      SystemDrive=C:
      SystemRoot=C:\WINDOWS
      TEMP=C:\DOCUME~1\BABARR~1\LOCALS~1\Temp
      TMP=C:\DOCUME~1\BABARR~1\LOCALS~1\Temp
      TMPDIR=C:\DOCUME~1\BABARR~1\LOCALS~1\Temp
      tvdumpflags=8
      USERDOMAIN=COMPAQ
      USERNAME=Babar Rehman
      USERPROFILE=C:\Documents and Settings\Babar Rehman
      windir=C:\WINDOWS

      so could you please figure the problem out….
      thanks in advance

      Quote

      Comment by rehman — August 7, 2008 @ 7:10 am

    6. More over, when i try to access bin folder in grail subdirectoy like c:\Grails\grails\bin>grails -v
      then i get such exception

      07.08.2008 03:32 src
      5 File(s) 16.833 bytes
      11 Dir(s) 3.895.259.136 bytes free

      C:\Grails\grails>grails -v
      ‘grails’ is not recognized as an internal or external command,
      operable program or batch file.

      C:\Grails\grails>cd bin

      C:\Grails\grails\bin>grails -v
      Exception in thread “main” java.lang.NoClassDefFoundError: org/codehaus/groovy/g
      rails/cli/support/GrailsStarter
      Caused by: java.lang.ClassNotFoundException: org.codehaus.groovy.grails.cli.supp
      ort.GrailsStarter
      at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
      Could not find the main class: org.codehaus.groovy.grails.cli.support.GrailsStar
      ter. Program will exit.
      C:\Grails\grails\bin>

      so i dont know what is going on

      Quote

      Comment by rehman — August 7, 2008 @ 7:36 am

    7. I ve solved the problem…

      Actuallz windows installer made a dir with name “grails” inside my grails installation folder
      for example
      C:\Grails\grails
      and i had declared GRAILS_HOME =C:\Grails
      now i have changed it GRAILS_HOME=C:\Grails\grails
      then typed command like grails -v
      and everything worked fine

      Quote

      Comment by rehman — August 8, 2008 @ 3:40 am

    8. Glad that it worked out for you rehman :)

      Quote

      Comment by tabrez — August 8, 2008 @ 8:33 am

    RSS feed for comments on this post. TrackBack URI

    Leave a comment

    Subscribe without commenting


    Copyright (c) 2006, 2007 Tabrez Iqbal.
    Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. Verbatim copying and distribution of this entire article is permitted in any medium without royalty provided this notice is preserved. A copy of the license is included in the section entitled "GNU Free Documentation License".


    Powered by WordPress
    This website is hosted by Dreamhost