Can you call compiled JRuby classes from java?

Posted by John Baker on Stack Overflow See other posts from Stack Overflow or by John Baker
Published on 2010-05-04T22:31:07Z Indexed on 2010/05/04 22:48 UTC
Read the original article Hit count: 165

Filed under:
|
|
|

So I came up with the general idea to write some code in JRuby, then access all the classes via Java. I have no idea if this is at all possible but I wanted to ask anyway. Lets say I have some JRuby code:

class adder
   def addme
      return 22
   end
end

If I compiled this with jrubyc is there any way I could then possibly do something like this in java:

import adder;
class anything {
    void testMethod() 
    {
       adder a = new adder();
       int x = a.addme();
    }
 }

After looking at it now it sort of makes me think that Java will have zero idea what sort of item test addme is going to return so that might not work. I don't know but I wanted to throw it out there anyway.

Thanks

© Stack Overflow or respective owner

Related posts about ruby

Related posts about jruby