> --
> You received this message because you are subscribed to the Google Groups "Avian" group.
> To post to this group, send email to av...@googlegroups.com.
> To unsubscribe from this group, send email to avian+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/avian?hl=en.
>
--
;; Gabe Johnson
;; PhD Candidate in Computational Design - Carnegie Mellon University
;; CoDe Lab: http://code.arc.cmu.edu/
;; Personal: http://six11.org/
> Guys, a little experiment to see whether avian could be used to run
> compiled groovy code.
> I suspect I'm stretching avian a little too far however I thought the
> results would be interesting and any feedback would be useful.
>
>
> Using a compiled standard compiled hello world groovy code. The java
> version
>
> ./java -cp test/tools.jar:test/groovy-all-1.8.6.jar:test HelloWorld
>
> prints the expected "hello world"
>
> unfortunately the avian version results in:
>
> ./avian -cp test/tools.jar:test/groovy-all-1.8.6.jar:test HelloWorld
> java/lang/ExceptionInInitializerError
> caused by: java/lang/ExceptionInInitializerError
> at HelloWorld.__$swapInit (unknown line)
> at HelloWorld.<clinit> (unknown line)
> caused by: java/lang/NoClassDefFoundError: java/math/BigInteger
> at org/codehaus/groovy/runtime/typehandling/
> DefaultTypeTransformation.<clinit> (line 39)
> at HelloWorld.__$swapInit (unknown line)
> at HelloWorld.<clinit> (unknown line)
That's just telling you that Avian doesn't have a java.math.BigInteger
implementation. In fact it doesn't have any java.math classes at all,
since no one has contributed them. If you were to add a compatible
BigInteger implementation and try running groovy again, you'd probably hit
another NoClassDefFoundError for another class Avian doesn't have.
Avian's built-in class library has only a very small subset of the classes
in the standard JRE, and those it has are generally incomplete relative to
the standard. That means it's unlikely that a non-trivial Java app such
as Groovy will work with it as-is.
If you want to get such an app working on Avian, you've got two choices:
1. Use the OpenJDK class library instead of the built-in one. This will
almost certainly be the easiest way. See readme.txt for details.
2. Build the app from source using the Avian class library as the boot
classpath (e.g. javac -Xmaxerrs 10000
-Xbootclasspath:../avian/build/linux-x86_64/classpath $(find . -name
'*.java')), let the compiler tell you what's missing, and implement
those things. Some apps might only need a few extra classes and
methods. Others will need an enormous number of them. Dynamic
languages like Groovy might be especially challenging if they rely
heavily on reflection, in which case the compiler might not be able
to tell you about all the classes needed at runtime. In that case,
you'll need to just keep testing and implementing until everything
works.
> I've tried to explicitly put the java tools.jar on the path with no
> joy.
> Any hints if this could be resolved would be greatly appreciated
>
> Thanks, Richard
>
> I've wondered the same thing for other JVM-targeting languages.
> Scala+Avian would be wonderful.
I haven't tried Scala yet, but last time I checked, Clojure, JRuby,
JScheme and Jython all worked when using Avian with the OpenJDK class
library. In Clojure, you even get tail call optimization and first-class
continuations for free:
> If you want to get such an app working on Avian, you've got two choices:
>
> 1. Use the OpenJDK class library instead of the built-in one. This will
> almost certainly be the easiest way. See readme.txt for details.
>
> 2. Build the app from source using the Avian class library as the boot
> classpath (e.g. javac -Xmaxerrs 10000
> -Xbootclasspath:../avian/build/linux-x86_64/classpath $(find . -name
> '*.java')), let the compiler tell you what's missing, and implement
Correction: use the -bootclasspath option, not -Xbootclasspath: