Groovy is a powerful new high level dynamic language for the JVM combining lots of great features from languages like Python, Ruby and Smalltalk and making them available to the Java developers using a Java-like syntax. Groovy is designed to help you get things done on the Java platform in a quicker, more concise and fun way - bringing the power of Python and Ruby inside the Java platform. Groovy can be used as an alternative compiler to javac to generate standard Java bytecode to be used by any Java project or it can be used dynamically as an alternative language such as for writing scripts or unit test cases.
Here's a simple example which demonstrates the basic syntax. Notice that Groovy is dynamically typed, has closure support and supports something similar to Python's tuple / sequence / dictionary support (List and Map in Java) class Foo { doSomething() { data = ["name": "James", "location": "London"] for (e in data) { println("entry ${e.key} is ${e.value}") } } closureExample(collection) { collection.each { println("value ${it}") } } static void main(args) { values = [1, 2, 3, "abc"] foo = new Foo() foo.closureExample(values) foo.doSomething() } } For more examples please try the examples section or try these sample scripts or the unit test cases Probably the best way to get started on Groovy is to install Maven, get a CVS checkout of the source code and then try running the unit tests & looking at them to see how Groovy works. e.g. maven clean test Groovy has a Swing interactive console that allows you to type in commmands and execute them rather like using an SQL query tool. History is available and such like so you can move forwards and backwards through commands etc. To run the Swing console type... maven console Or to see a simple example of how Groovy can be used to script things like creating Swing user interfaces try... maven swing:demo |