I wanted to run groovy on jamvm in an embedded hardware. The following is what I have tried, but nothing works.
1)
$GROOVY_HOME/bin/groovy ...
It complains that JAVA_HOME is not set. Since JamVm is a standalone executable, how, if possible, to set JAVA_HOME in JamVM? If the problem reduces to setting that, it's easy to solve.
2)
jamvm -cp $GROOVY_HOME/embedded/embeddable/groovy-all-2.0.5.jar:. TestClass
I ran the example in http://groovy.codehaus.org/Embedding+Groovy ('full example' part) and got the following exception. I ran the same example on Mac, it was fine.
Exception in thread "main" BUG! exception in phase 'semantic analysis' in source unit '/root/test/Tester.groovy' 0
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:907)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:566)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:515)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:279)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:258)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:244)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:185)
at TestClass.main(TestClass.java:8)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
at org.codehaus.groovy.vmplugin.v5.Java5.makeParameters(Java5.java:396)
3) I tried
java -cp ../groovy-2.0.5/embeddable/groovy-all-2.0.5.jar groovy.lang.GroovyShe
ll <script.groovy>
didn't work, got the following
java.lang.ExceptionInInitializerError
at org.codehaus.groovy.reflection.ReflectionCache.getCachedClass(ReflectionCache.java:107)
Please suggest a way to run groovy on jamvm. Thanks!