|
|
|
You can create a java class with a main, like this one:
public class Sample { public static void main(String[] args) { GroovyClassLoader loader = new GroovyClassLoader(TesteMain.class.getClassLoader()); Class clazz = loader.parseClass(new File("c:\\Script.groovy")); System.out.println(clazz.getCanonicalName()); for (Method m : clazz.getMethods()) { for (Annotation a : m.getDeclaredAnnotations()) System.out.println(a.toString()); } } We are running using Eclipse, and we only import the "groovy-all.jar" file. I forgot to mention: The problem also happens with GroovyScriptEngine.
Have you tried to run your code from command line? This is the info I have asked for in my comment, but I don't seem to have got an answer.
./alex Hi,
Sorry taking so many time to answer. I've tested in the command prompt and everything worked fine. What is really strange is: if I use the same code in my app environment, the problem still occurs. I'm completely sure about the groovy version i'm using. Is there any trace I can take? Anyway, I'll try to reproduce the exact circumstances in which the error occurs. Re-open if you find the exact circumstances that lead to this problem.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||
./alex
–
.w( the_mindstorm )p.