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.

Subscribe to Grails Academy Magazine.

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.

Grails Academy Magazine

Grails Academy Magazine now available.

109 thoughts on “Installing a Grails Development Environment on Windows

  1. Update: I uninstalled ALL java (except JavaFX), and installed java1.7.0_65 (x86).
    result is that java.home in ggst now points to c:\program filed (x86)\java\jre7 instead of the the java\sdk map

  2. Update on my problem:
    I found the configuration tab of GGST starting from “About”.
    It says java.home points to \JRE6 (first java installed on this pc in 2011, meanwhile changed to 7.1.20 and yesterday to 7,1,65). Where does ggst get this data?

  3. I encounter a problem when I create the new project (test). it says:

    Grails requires JDK. Try to run Grails commands with only a JRE may fail with cryptic error messages, or no error messages at all. The default JMV configured in your workspace appears to be JRE.

    Please ensure that the JDK is configured as the default JMV in your workspace.

    My java:home points to C:\Program Files\Java\jdk1.7.0_65 (execute CMD.exe, and SET command shows settings)
    Tried also to create a tiny java project, which runs both in RUN and DEBUG

    Thank you for your reply.

  4. I installed grails-2.4.2 and jdk1.i.0_05 in a Vagio notebook runing on Wildows 8. The demo example runs OK. Then I installed ggts-3.5.1 and it did not show any error while installing. However, when I try the test example it spot and gives me a “Problem Occurred” message: “’Building workspace’ has encountered a problem” and details show: Errors occurred during the build. Errors running builder ‘Java Bulder’ on project ‘test’. org.codehaus.groovy.runtime.DefaultGroovyMethods.count(Ljava/lang/lterable;groovy/lang/Closure;)Ljava/lang/Number;
    Could you help me to find what is wrong?

    • If you are using Grails 2.4.0 in GGTS, you will need to install the Groovy 2.3 compiler plugin. On the right side of the dashboard tab, click the IDE Extensions link. Then find and check the Groovy 2.3 Complier for Groovy-Eclipse. Check install in the lower right and accept all the defaults. Then create a new project.

  5. Hi:

    I’ve watched the video multiple times, but I still can’t get the correct message from the command prompt fro grails (I do get the correct one for Java). I’ve appended everything I was instructed to on the path variable, as well as the GRAILS_HOME, but I still can’t get the correct message. Any thoughts?

    My Path variable is:

    C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;%JAVA_HOME%\bin;%GRAILS_HOME%\bin

    GRAILS_HOME is:

    C:\grails\grails-2.4.0

    • Your settings look good. When you look inside of c:\grails\grails-2.4.0, do you see several folders and files including the bin folder? Also, make sure you have closed and reopened your command prompt after making the changes.

  6. Thank you for the video. I am following the video to create my first grails project on GGTS 3.5.1 and I got the same problem every time. It could not even finish the creating.

    Errors occurred during the build.
    Errors running builder ‘Java Builder’ on project ‘demo’.
    org.codehaus.groovy.runtime.DefaultGroovyMethods.c ount(Ljava/lang/Iterable;Lgroovy/lang/ClosureLjava/lang/Number;

    Error detail:
    Problems occurred when invoking code from plug-in: “org.eclipse.core.resources”.

    Could you give me some ideas about what’s going on and how to fix it. Thanks in advance.

  7. What am I doing wrong here? I’m moving to Grails 2.4.0 (Windows 7 enterprise) and am having troubles with my environment variables set up correctly. Here’s my stuff….

    GRAILS_HOME C:\grails\grails-2.4.0

    JAVA_HOME C:\Program Files\Java\jdk1.7.0_51

    yet when I run-app from a cmd prompt I get this:

    C:>echo %GRAILS_HOME% C:\grails\grails-2.3.7

    and also…here is entire PATH variable %GRAILS_HOME%\bin;%JAVA_HOME%\bin;C:\oracle\product\11.2.0\client_32\bin;%System‌​Root%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%systemroot%\System32\Wind‌​owsPowerShell\v1.0\;C:\Program Files\SlikSvn\bin;C:\Program Files (x86)\ActivIdentity\ActivClient\;C:\Program Files\ActivIdentity\ActivClient\

    Given the above… when I do a run-app I get the following. What could be wrong and does it relate to my env variables?

    C:\Users>grails run-app Picked up JAVA_TOOL_OPTIONS: -Djava.vendor=”Sun Microsystems Inc.” Error opening zip file or JAR manifest missing : C:/grails/grails-2.3.7/lib/org. springframework/springloaded/jars/springloaded-1.2.0.RELEASE.jar Error occurred during initialization of VM agent library failed to init: instrument

    C:\Users>

    • It looks like Windows still thinks your GRAILS_HOME variable is set to your 2.3.7 directory. Double check your settings and be sure to close and reopen your command prompt after making any changes. You can enter the set command at your command prompt to get a listing of your environment.

  8. Hi, I’m trying to install and use grails following the video instructions.
    I am able to properly create the application but when running it that’s what I get:

    | Error Compilation error: startup failed:
    C:\Users\Diego\test3\target\work\plugins\database-migration-1.3.8\grails-app\con
    trollers\grails\plugin\databasemigration\DbdocController.groovy: -1: Repetitive
    method name/signature for method ‘java.lang.Object withFormat(groovy.lang.Closur
    e)’ in class ‘grails.plugin.databasemigration.DbdocController’.
    @ line -1, column -1.
    C:\Users\Diego\test3\target\work\plugins\database-migration-1.3.8\grails-app\con
    trollers\grails\plugin\databasemigration\DbdocController.groovy: -1: Repetitive
    method name/signature for method ‘java.lang.Object withFormat(groovy.lang.Closur
    e)’ in class ‘grails.plugin.databasemigration.DbdocController’.
    @ line -1, column -1.
    2 errors

    Can anyone help me understand what I am doing wrong?

    • Diego:

      Unfortunately, Grails will not run under Java 8. You will need to install version 7 of the JDK instead.

      ~Mike

  9. Just did a new fresh install (Windows 8 Pro) with Grails 2.3.6 on top of Eclipse Kepler.
    I do not know if it matters, but I get this error message when creating and deploying the test app as instructed in the video:

    |Loading Grails 2.3.6
    |Configuring classpathFeb 20, 2014 11:35:56 AM java.util.prefs.WindowsPreferences
    WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(…) returned error code 5.

    and the process to build a deploy continues:
    .
    |Environment set to development
    ……………………………
    |Packaging Grails application
    ……………………………………
    |Running Grails application
    |Server running. Browse to http://localhost:8080/test

    And I can launch in the browser as I did with the CLI demo app.
    What does this erro mean? Any input is welcome :) Right now I do not know what will go wrong, just nervous to see such error msg from an empty app.

    Cheers, Vincent

  10. Hi I’m new to Grails. I followed your tutorials but I got this error when I try to create-app demo.
    Loading grails
    Configuring classpath
    Environment set to development
    Created grails application at C:\grails\demo
    –im using grails 2.3.5/OS vista 32bit/jdk-7u51

    • Hi Zysert:

      It looks like everything worked as it should. Now just change directories into demo and type grails run-app.

      Regards,
      Mike

      • All right thanks Mike.
        I also tried to run an app using ggts but got this error.
        |Loading Grails 2.3.5
        |Configuring classpath
        .
        |Environment set to development
        ……………………………
        |Packaging Grails application
        ……………………………………
        |Running Grails application
        Error |
        Server failed to start for port 8080: Address already in use: JVM_Bind (Use –stacktrace to see the full trace)

        • It looks like you already have the application running, perhaps in a command prompt. If you shut down all of your Java processes, or restart your machine, it will probably work fine. If you do have an actual conflict on that port, check out the video on setting up the TimeTracker application and I show you how to change the port that your application runs on. Let me know if that solves the issue.

          • Restarting the PC helps. Thanks a lot, I’m gonna watch more of your video tutorials to know more about grails. :)

        • If you followed the video step by step, you probably still have the demo app that you have created and started from the cmd line. Give it a CTRL-C, terminate batch job = Y, then it should go back to the cmd line prompt and you should be able to run test again and click on the link in Eclipse and see your app up and running.
          Thx, V

        • If you followed the video step by step, you probably still have hte demo app that you have created and started from the cmd line. Give it a CTRL-C, terminate batch job = Y, then it should go back to the cmd line prompt and you should be able to run test again and click on the link in Eclipse and see your app up and running

  11. Hi,
    Thanks for the gr8 video tutorials .I am quite new to grails. I have an issue though running grails from command prompt. Grails project works perfectly fine from eclipse . From command prompt, grails run-app works fine, but grails run-app gives errors. The error is below.

    |Loading Grails 2.3.5
    |Configuring classpath
    .
    |Environment set to development
    ……………………………
    |Packaging Grails application
    ……………………………………Error
    |
    FATAL ERROR: ‘org.apache.xml.serializer.utils.WrappedRuntimeException: org.apache.xml.serializer.ToXMLSAXHandler incompatible with org.apache.xml.serializer.SerializationHandler’
    :org.apache.xml.serializer.ToXMLSAXHandler incompatible with org.apache.xml.serializer.SerializationHandler
    Error |
    org.xml.sax.SAXParseException: Premature end of file.
    Error |
    at _Events.fixWebXml(_Events.groovy:21)
    Error |
    at _Events$_run_closure1.doCall(_Events.groovy:11)
    Error |
    at _GrailsPackage_groovy$_run_closure5.doCall(_GrailsPackage_groovy:74)
    Error |
    at _GrailsPackage_groovy$_run_closure2.doCall(_GrailsPackage_groovy:58)
    Error |
    at RunApp$_run_closure1.doCall(RunApp.groovy:28)
    |Running Grails application
    |Server running. Browse to http://localhost:9090/myapp

    Any help would be appreciated. Googling dint help much to solve the issue

    • Are you using the Java package from Java.com? There are some threads that say the IBM package causes this error. Otherwise, check your path and make sure it points to the bin directory of your JDK and not the JRE directory.

      • Sorry for the late reply.. It was a very stupid mistake actually. I had changed the path and Java home in my system environment variables but i had a JAVA_HOME in my user envt variables which was using webspheres JDK and overridding the JAVA_HOME i set in system envt vars.. thanks a lot for the help:-)

  12. I followed the tutorial , with
    C:\Documents and Settings\patron.luca>java -version
    java version “1.7.0_45″
    Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
    Java HotSpot(TM) Client VM (build 24.45-b08, mixed mode, sharing)
    C:\Documents and Settings\patron.luca>grails -version
    Grails version: 2.3.4
    but got this:
    | Script ‘Create’ not found, did you mean:
    1) CreateApp_
    2) CreatePom
    3) CreateScript
    4) CreateFilters
    5) CreateUnitTest
    > Please make a selection or enter Q to quit: 1
    | Created Grails Application at D:\Luca\Grails\demo

    D:\Luca\Grails>cd demo

    | Configuring classpath
    | Error Resolve error obtaining dependencies: Failed to read artifact descriptor
    for xalan:serializer:jar:2.7.1 (Use –stacktrace to see the full trace)
    | Error Required Grails build dependencies were not found. This is normally due
    to internet connectivity issues (such as a misconfigured proxy) or missing repos
    itories in grails-app/conf/BuildConfig.groovy. Please verify your configuration
    to continue.

    | Configuring classpath
    | Error Resolve error obtaining dependencies: Failed to read artifact descriptor
    for xalan:serializer:jar:2.7.1 (Use –stacktrace to see the full trace)
    | Error Required Grails build dependencies were not found. This is normally due
    to internet connectivity issues (such as a misconfigured proxy) or missing repos
    itories in grails-app/conf/BuildConfig.groovy. Please verify your configuration
    to continue.
    any help would be greatly appreciated!

  13. When I created my demo app from the first tutorial and when I created my test app from the second tutorial I got the same message.

    *** java.lang.instrument ASSERTION FAILED ***: “!errorOutstanding” with message transform method call failed at ../../../src/share/instrument/JPLISAgent.c line: 844
    Exception in thread “main”
    Error |
    Forked Grails VM exited with error

    can anyone help with this, please?

  14. Previously,thanks a lot for your video.I’d like to know why there are two errors occurred on my computer ,saying that resolve error obtaining dependencies :could not transfer artifact org.grails,according the steps.Could anyone help me?

    • I also get similar 2 errors, but the app seems to run fine. Would be nice to know what those errors mean though, and how to fix them. Regardless, this is a *** GREAT VIDEO *** Thank you Mike!!

    • What error messages are you seeing. When you execute “grails -version” and “java -version” do you get the correct response?

  15. i must say that the video tutorial is very good but when i run-app demo, it is not downloading from c:/ directory and gives error like “Resolve error obtaining dependencies”:………. i don’t know whether it will work properly or not

  16. Hi, I watched your video and done step by step like you did. everything is working except the last thing. when I create a new project (test) I can’t run it. it says:

    Grails requires JDK. Try to run Grails commands with only a JRE may fail with cryptic error messages, or no error messages at all. The default JMV configured in your workspace appears to be JRE.

    Please ensure that the JDK is configured as the default JMV in your workspace.

    Thank you for your reply.

    • Hi Susan:
      It sounds like your JAVA_HOME environment variable may be set incorrectly. In your computer’s environment variables, what do you have it set to? Mine is set to C:\Program Files\Java\jdk.1.7.0_30. Your location and version may be different, but make sure you set it to the jdk directory and not the jre directory.
      ~Mike

  17. I kept getting ‘grails’ is not a recognized internal or external command, and found that what resolved it, was to declare the Environmental Variables in the User section, not the System section.

    • The difference between user and system is that the user variables only execute for your logged in user. The key is to ensure that you close and reopen your command prompt after setting the variables.

  18. Thanks a lot for this tutorial.
    I can run the app from both cmd and IDE, but I get the message in red that seems warning or something. Here is the message:
    Running Grails applicationJun 14, 2013 6:08:43 PM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["http-bio-8080"]
    Jun 14, 2013 6:08:43 PM org.apache.catalina.core.StandardService startInternal
    INFO: Starting service Tomcat
    Jun 14, 2013 6:08:43 PM org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet Engine: Apache Tomcat/7.0.39
    Jun 14, 2013 6:08:44 PM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
    INFO: No global web.xml found
    Jun 14, 2013 6:08:44 PM org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring root WebApplicationContext

    | Server running. Browse to http://localhost:8080/ProjectTracker

    • I get those too on Grails 2.2.2. They appear to just be information messages that the different components of the architecture have started.

  19. 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

  20. 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!

  21. 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.

    • Hey,
      It might be late but i faced the same problem. you should try creating a new user variable rather than system variable in Environment variables. And in the user variable create a path with the full path of grails’ bin.

  22. 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

  23. 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.

  24. 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.

  25. 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.

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

  27. 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.

  28. 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

  29. 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.

  30. 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?

  31. 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?

  32. 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

  33. 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

  34. 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>