I've been wanting to embed a JRuby REPL in Eclipse applications I'm building for some time now. I finally started picking at the code to test feasibility and ran into one simple issue. Basically, I wanted to have an Eclipse App load up the JRuby runtime, then run a simple(-ish) Ruby script within that runtime, where the script itself should load a Java class visible to the application bundle, but not explicitly visible to the JRuby bundle.
I've uploaded the sample app to https://github.com/ajuckel/net.juckel.osgirubytest if anyone wants to check it out, but the only gotchas with the 1.6.0.dev bundle were: 1) I had to use ScriptingContainer#setClassLoader(ClassLoader) to make sure that my bundle's classloader was used to lookup classes within JRuby. My bundle then does a Require-Bundle on org.jruby.jruby. 2) After that was done, in order for require 'java' to work, I had to update the jruby.bnd.template to export builtin.* so my application bundle could see the builtin resources. I'm not a big fan of this second step, so either I'm doing something wrong in my sample app, or a more intelligent classloading change would have to be made within JRuby itself. I'm also curious if anyone to hear stories from anyone else running JRuby within an OSGi context. Anthony Juckel