|
Running Embedded Groovy: msg#00113lang.groovy.user
Hi, Can anyone shed any light on why I get a "java.lang.IllegalArgumentException: wrong number of arguments" when I try to invoke the 'static void main' of my Groovy class read from a classpath? GroovyClassLoader gcl = new GroovyClassLoader(); Class result = gcl.parseClass(new java.io.File("target/test-classes/HelloWorld.groovy")); Method m = clazz.getMethod("main", new Class[] {String[].class}); m.invoke(null, null); or m.imvoke(null, new String[]{}); or m.invoke(null, new String[] {"hello"}); the HelloWorld.groovy script can be simply: println "Hello there" or a simple class def: public class HelloWorld { public static void main(String[] args) { println "Hello There!" } } Thanks, Sean -- Dr. Sean Radford, MBBS, MSc sradford-QOAqXozMTYgdemNxvH84G7VCufUGDwFn@xxxxxxxxxxxxxxxx http://bladesys.demon.co.uk/
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Java World: Build scripts with Groovy and Ant artcicle, Daniel Serodio |
|---|---|
| Next by Date: | Did anyone post a response to "the optional features considered sucky" article, Furash Gary |
| Previous by Thread: | Variable defined, juhani |
| Next by Thread: | Re: Running Embedded Groovy - solved, Sean Radford |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |