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
There's actually a new way to do this in JRuby 1.5! Your question is very timely. Here's an example session:
http://gist.github.com/390342
We will hopefully have a blog post detailing this new feature very soon. There's some preliminary docs on the JRuby wiki here:
http://wiki.jruby.org/GeneratingJavaClasses
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With