Installing a Grails Development Environment on Windows


Updated for Grails 2.2.x
In this Grails Example, we will set up our development environment on a Windows system.

This first video shows you how to install Grails and Java on Windows. To install Grails, you will need a Java Developers Kit (www.java.com), and the Grails libraries (www.grails.org). This video will show you how to download and install both. It then shows how to set the appropriate environment variables to allow you to run Grails commands from the command prompt.

In the second video, you learn how to install an Integrated Development Environment (IDE) based on Eclipse called the Groovy & Grails Tool Suite. This tool is pre-configured for Groovy and Grails to give you features such as syntax highlighting and code completion. The video shows you how to install it and configure it for the Grails 2.2.x environment that you installed in the previous video.

44 thoughts on “Installing a Grails Development Environment on Windows

  1. Hi,

    I’m getting the following while creating the sample ‘test’ application as per the above groovy/grails tool suite installation video. Can you please help me in resolvingt this issue. FYI, I’m installing it on a ’64bit Windows 7 Professional Sergice Pack 1′ platform.
    Loading Grails 2.2.2
    | Configuring classpath
    | Error Failed to resolve dependencies (Set log level to ‘warn’ in BuildConfig.groovy for more information):
    - org.eclipse.jdt.core.compiler:ecj:3.7.2

    Thanks,
    Purna

  2. Great stuff! I would recommend a couple of minor additions that tripped me up on the installation phase:

    * How to set up a proxy, especially on Windows. This can be a HUGE pain if you don’t know exactly how to do it.

    * How to shut down the app once it’s started with run-app. I still just press Ctrl+C and don’t even know if that’s really the best way :/

    Thanks again for providing this great resource for free!

  3. Hi,
    I downloaded grails 2.2.0 on win 7, 64 bit machine, extracted to C:\grails-2.2.0\grails-2.2.0, in the cmd prompt on entering java -version, got the result as
    java version “1.7.0.09″
    Java SE………
    Java Hotspot 64 bit……….

    but for grails -version got error as
    Error: JAVA_HOME is set to an invalid directory: C:\Program files \Java\jdk1.6.0_24
    Please set………

    Again I tried with grails 2.1.1 and got the same error

    Can you pls help….

    • It sounds like you upgraded Java at some point and your JAVA_HOME and PATH variables need to be reset. Check out the part in the video about setting these variables on Windows and see if it helps. Be sure to open a new command prompt after changing the environment variables.

  4. Hi Mkelly
    I downloaded grails-2.2.0 just recently and extracted as per your instructions . now when i try to check from command prompt by Grails -versions i get the message ” the system cannot find the path specified ”
    the valiables setting is OK but i dont know what dose it means.
    i appreciateyou for your help.
    thanks
    Ali

  5. Mike, Excellent tutorials. Installed grails 2.1.1 and run-app demo and ‘test’ under
    eclipse 4, it is a wonderful day, thank you very much.

  6. Hello.

    For the first part I have problem to connect with the server localhost. It doesnt shows anything in the web. I have another running localhost called myphpadmin. I dont remember when and where I installed it. How can I remove that one from my localhost then this will work.

  7. Hi Mike,

    I downloaded grails-2.1.1 just recently and extracted as per your instructions on this video. I realised it doesn’t have bin file in the extraction. So when i did grails -version its says “‘grails’ is not recognized as an internal or external command,
    operable program or batch file.”

    Hope u can help.

    Cheers…

    • I just downloaded 2.1.1 from grails.org and when I unzipped it, there was a bin folder. Perhaps your file did not download correctly or it had problems unzipping.

  8. Pingback: Java Exception when Trying to Run Grails | Jisku.com - Developers Network

  9. Mike – Thanks for your excellent tutorial.

    I used your tutorial in April to install grails 2.0.4 and JDK 1.6.0_29 on my WinXP 32bit machine which worked flawlessly.

    I just downloaded the latest grails (2.1.0) and JDK (1.7.0_17) on my Win7 64bit machine and followed the steps in your tutorial:
    1.) Add environment variables for Java and Grails
    2.) Update path as appropriate
    3.) Verify that everything installed correctly by executing “java -version” and “grails -version”

    The java -version command works, but the grails -version command yields the following error:

    Exception: java.lang.RuntimeException thrown from the UncaughtExceptionHandler in thread “main”

    Any idea is to why this occurred? Thanks.

    • Hi Tom:

      Glad you like the videos. Did you install the 64-bit java jdk on your Win7 machine. What do you get back when you run java -version?

      ~Mike

      • Yes, I installed the 64-bit java jdk on the Win7 machine; here’s what I got back when I ran java -version:

        java version “1.7.0_07″
        Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
        Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)

        I had earlier versions of Java on my machine, so I made sure to remove them via the “Add / Remove Programs” utility. The Java 1.7 installation also included Java FX 2.1.1; would this program negatively impact the grails install?

        Thanks for your quick response.

        • Java FX would not cause the problem. I found that if I removed %JAVA_HOME%/bin from my path, java -version and grails -version still worked. So that means Grails is finding the Java libraries by some means other than the path. My guess is there is something left over from your previous install that Grails is trying to point to. Unfortunately, my expertise ends there. There are some great folks over at stackoverflow.com and on the Grails FaceBook page that could probably answer this.

  10. Hi mkelly,

    Thanks for posting this useful videos, it really help me a lot, since i’m not familiar with any of these environment.

    I already install java, copy grails, set the environment path. but when I try to call grails from command line it shows

    ‘grails’ is not recognized as an internal or external command, operable program or batch file.

    is there any step that I miss?
    my OS is windows 7 home edition sp1

    • Hi Nel:
      Glad you are liking the videos so far. The error you are getting is that the command line cannot find where Grails is installed. There is a subtle difference between the GRAILS_HOME setting that points to the Grails directory, and the PATH setting that points to the bin directory inside of GRAILS_HOME. To make sure everything is set correctly, open up a command prompt and type ‘path’ followed by pressing enter. Make sure there is an entry for Grails and that it points to the bin directory where the grails files are. Remember that if you copied the Grails folder inside of a directory called grails like I do in the video, the path should be C:\grails\grails-2.1.0\bin. Also make sure there is a semicolon between the grails entry and the one before it. If you can’t get it working, paste your path below so I can take a look.
      ~Mike

  11. Really good tutorial for the windows installation. Grails is running now!
    Thank you so very much. This videos could be part of the fist steps section of Grailswebsite.

    • Thank you. They were nice enough to add them to the installation documentation at grails.org. I will be updating them for 2.1.0 soon.

  12. After spending hours debugging compatability and configuration issues with django and ruby, it was REALLY nice to have a simple, clean easy method to get started. By doing the videos, there are a lot of things such as changed links, version types, etc that you are able to pick up on.
    Great Job!

    • Works well! It is not obvious, thugoh. Will new users know to click on the yellow bubble or time stamp?Within the thread itself, perhaps you can put the same yellow bubble next to the title of the thread to keep things consistent? Maybe a yellow bubble with a down arrow?

  13. run ‘grails create-app myapp’, get error:
    | Error Error executing script CreateApp: The following error occurred while executing this line:
    java.io.FileNotFoundException: C:\Documents and Settings\Nk\.grails\ivy-cache\org.apache.ant\ant\jars\ant-1.8.2.jar (绯荤粺鎵句笉鍒版寚瀹氱殑璺緞銆? (Use –stacktrace to see the full trace)

    • i know problem what is, cause my login account is Chinese, when I login windows with Administrator, done. why does grails could not support Unicode account?

  14. i install grails followed documentation, and run ‘grails -version’ is right, but when I run ‘grails create-app myapp’, I get error with ant-1.8.x.jar can not be found in directory c:\Document And Settings\Nk\.grails\…
    what about this error? my system is Windows XP SP3, localization is Chinese, and grails was installed in C:\grails-2.0.4, GRAILS_HOME=C:\grails-2.0.4

  15. I am getting an error when I create a new Grail Project in Eclipse. .

    java.lang.NoClassDefFoundError: org/codehaus/groovy/tools/RootLoader
    Exception in thread “main”

    Can you please let me know what the problem is? I have successfully followed the steps so far in the video ..Quick reply would be highly appreciated.I am using jdk1.6.0.3

  16. Really really helpful, I was looking for something like this many months ago, It’s a clear way to show how things works on Grails.
    Great job,Thanks again.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>