File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Groovy and the fly likes groovy vs grails Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Groovy
Bookmark "groovy vs grails" Watch "groovy vs grails" New topic

groovy vs grails

Rauhl Roy
Ranch Hand

Joined: Aug 01, 2006
Posts: 401

May i know the difference between Groovy and grails.

and how the groovy and grails can be compared with java. is these technologies are alternative to Java,j2ee???

many i know more on this.

many thanks in advance,
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Yeah, there is no "vs" in that equation.

Grails is a web framework from front end to back, Groovy is a "language" that Grails uses. Grails also has GORM which uses Hibernate, and Grails also uses Spring MVC and Spring Framework. You can add lots of different plugins to Grails to use other technologies and get other features, like plugin for acegi security which is Spring security.

Groovy is a scripting type language that is very close to Java, but adds features that Java doesn't have like closures and mix-ins

The code you write in Groovy is a quite a bit less than Java, you don't hvae to import any java.util class, you don't need any semicolons.

You still use Java in Groovy, but it is slightly different. Like I said Groovy makes Java coding easier.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
chris webster

Joined: Mar 01, 2009
Posts: 2288

Hi Rahul,

There's a good introductory video on Grails at:

As Mark says, Groovy/Grails is like Ruby/Rails i.e. Grails is a web application development framework implemented in Groovy, on top of lots of JEE stuff (Spring, Hibernate etc). It's designed for the JEE platform and the standard Grails download includes everything you need to get started i.e. all the Java libraries, Groovy and a Tomcat or Jetty servlet engine. Your Grails web application can be deployed as a WAR on any JEE server, just like any other JEE web app. You can mix in Java code in your Grails application (as with any other Groovy application), or drop down to Hibernate level etc if you think it's necessary e.g. for integrating legacy DB stuff. In short, Grails makes JEE development fun again.

Groovy is independent of Grails i.e. you can install Groovy without ever using Grails. Groovy code runs in the JVM and you can use any Java classes in your Groovy scripts, so it allows you to combine existing/legacy Java code or standard Java libraries with new Groovy code in whichever way you like. Groovy typically requires far fewer lines of code than Java for many tasks. Examples:

Book tip: "Programming Groovy" by Venkat Subramaniam is pretty good and fairly up to date.

Also, there's supposed to be a new updated edition soon of "Groovy in Action" by Dierk Koenig, which will definitely be worth getting when it comes out. Groovy has developed quite quickly in recent years, so older books may not cover everything you can do with Groovy.


No more Blub for me, thank you, Vicar.
I agree. Here's the link:
subject: groovy vs grails
It's not a secret anymore!