Exception java.lang.IncompatibleClassChangeError while running Groovy in Eclipse Juno

user898535 picture user898535 · Jul 31, 2012 · Viewed 21.2k times · Source

I have recently downloaded Eclipse Juno and installed latest Groovy plugin.

Now here is how my Groovy file looks like.

package groovy_support

class TimePass {
static void main(def args){
    println "Hello World"
}
}

When i run this from either my previous eclipse version (indigo) or from command line, it runs. On Eclipse Juno, however, it complains with following exception on Eclipse console.

Caught: java.lang.IncompatibleClassChangeError: Found class org.objectweb.asm.ClassVisitor, but interface was expected
java.lang.IncompatibleClassChangeError: Found class org.objectweb.asm.ClassVisitor, but interface was expected

Note that "Groovy Libraries" are already on classpath.

Now what am i doing wrong here?

Answer

Ajay George picture Ajay George · Jul 31, 2012

Are you on the latest groovy/dependent jars? .

The java.lang.IncompatibleClassChangeError happens due to back ward compatibility issues. The client code needs to be recompiled to resolve it.

The specific error you are seeing is because org.objectweb.asm.ClassVisitor is an Interface in asm 3.2 and a Class in asm 4.0 onwards.