Arc Forumnew | comments | leaders | submitlogin
2 points by rocketnia 2072 days ago | link | parent

Some ways to call Java from Rainbow are listed here:

I think the best way to get up to speed with Rainbow is to see it in action ( and to look at exactly what the selection of JVM-related primitives is (

A while back, I made a library, jvm.arc, that I find slightly more convenient to use for accessing JVM stuff from Arc, regardless of whether I'm using Rainbow or Jarc (

More recently, jazzdev released a version of Jarc that implemented Rainbow's style of JVM access in addition to the Jarc style ( I cover a lot of corner cases in jvm.arc using reflection, and some of those could probably be implemented in a more direct style now.

One thing to note: Jarc and Rainbow each have their own policies for automatically converting between Arc values and java.util.Maps and such. This is convenient in practice, but it may make some corner-case things impossible without writing custom code in another JVM language like Java. For instance, if a single utility (say, a JSON parser) can return either java.lang.Boolean.FALSE or null, Arc will probably see nil in both cases.

1 point by jsgrahamus 2071 days ago | link

"I think the best way to get up to speed with Rainbow is to see it in action (

So I looked at swing.arc and tried copying and pasting it into Jarc:

  Jarc> (java-imports java
    (lang Integer Float)
    (awt Font event.KeyListener))

  (stdin):1: Error: Symbol 'java' has no value

  0:      java
  DEBUG 0:
Does something need to be loaded before executing this?

Thanks, Steve


1 point by varbanov 2069 days ago | link

java-imports is Rainbow specific construct. Jarc doesn't have such function. I guess Jarc doesn't have imports :)