Sonntag, Juni 28, 2009

groovy tools very picky at GROOVY_HOME

Today my groovy script wouldn't start. It couldn't find org/apache/commons/cli/CommandLineParser. As I didn't use this class I tried groovy -version. This also produced:

java.lang.NoClassDefFoundError: org/apache/commons/cli/CommandLineParser
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(
at java.lang.Class.getMethod0(
at java.lang.Class.getMethod(
Caused by: java.lang.ClassNotFoundException: org.apache.commons.cli.CommandLineParser
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at java.lang.ClassLoader.loadClassInternal(
... 6 more

Next I checked if I had set GROOVY_HOME and JAVA_HOME. OK.

Asked the web and found a bug report with the same error message. The conclusion is that startGroovy fails to accesses some resources, if a constructed path from GROOVY_HOME, contains //.

As I had created my GROOVY_HOME with TAB completion, the path had a / at the end. Removing this one fixed the problem.

Samstag, Juni 27, 2009

mixing Java and Groovy in Eclipse

As a server back end for Greasemonkey calls I use The work is done inside an implementation of the interface. To write the HttpHandler in Java started to take more time as I was willing to spend. So I thought it is a good idea to try out Groovy.

Installing Groovy and the corresponding Eclipse plugin was no problem. Running the first test script was straight forward also. But compiling a Java and a Groovy class inside the same project didn't work.

Therefore I did a test by hand.


  • compile the Groovy class inside projects src directory:

    1. groovyc PlayHttpHandler.groovy

    2. javac

    3. javac

  • start the server: java -cp /Volumes/Macintosh\ HD/Applications/groovy-1.6.3/embeddable/groovy-all-1.6.3.jar AjaxHttpServer

This worked. So try again in Eclipse.

First step was to clean the project. But it still doesn't work. All classes are build twice. In bin the Groovy class has an unresolved compile problem. To me it looks like the class was build with javac. In bin-groovy the Groovy class is OK. Unfortunately the Groovy class used during run time is the one from bin. Not sure how to fix this.

Donnerstag, Juni 25, 2009

Javascript speed of Firefox 3.5

Today I installed Firefox 3.5 RC. The first thing I did was to test the speed of the new Javascript engine. For this I used sunspider. On my machine Safari is still twice as fast as Firefox.

But as long as Safari has no security features like NoScript and CS Lite I will not use it.