Thursday, February 21, 2008

Groovy on my eee PC

I've been itching to play with a dynamic language for a while now and decided to hunker down with Groovy.

I fired up eclipse and decided to install the Groovy plug-in.

Here's are the steps I took:

  • Selected Help -> Software Updates -> Find and Install -> Search For New Features
  • Click on New Remote Site
  • Enter a name (I used Groovy) in the Name field
  • Typed the URL http://dist.codehaus.org/groovy/distributions/update/ into the URL field and press OK
  • Check the new Groovy repository and press finish
  • Under Select the Features to Install check the Groovy check box (be sure to get the latest version) and press Next
  • Accept the agreement and press Next
  • If the default location looks okay press Finish (this will download the plugin)
  • If you get a warning that the plugin is unsigned click Install or Install All
Then I created a basic Hello World Groovy project in Eclipse by performing the following steps:
  • Go to: File -> New -> Project
  • Select Java Project and press Next
  • In the Project Name field enter the name of your project (GroovyJava)
  • Under Project Layout select Create separate source and output folders and press Finish
  • In the Package Explorer find the newly created project, right click, and select Groovy -> Add Groovy Nature

The next steps may be needed to make the GroovyJava folder the default output folder, and to connect it to the src folder so that the debugger will know where to find the associated source and classes:

  • In the Package Explorer, right click on the "GroovyJava" project, and select: Build Path -> Configure Build Path
  • Select the Source tab and then check that the Default Output Folder is GroovyJava (use the Browse button to change it if you need to)
  • Press OK.
Then I created a groovy file File -> New -> File and then entering groovyjava.groovy as the file name.

Once the file was created I entered the Groovy Hello, World of:
println "Hello, World!"
Then running the GroovyJava project yielded the desired "Hello, World!" greeting in the console.


Now I'm ready to start my voyage into the Groovy world of an agile, dynamic Java-based language on my eee PC. Groovy baby!

0 Comments:

Post a Comment

<< Home