(LoadError) no such file to load -- jruby/jruby.rb
I think you bundle is probably corrupt. BTW, jruby-complete is already an OSGI bundle, so try the same without wrapping: it should definitely be able to load its own classes.
However, for the next step:
container.runScriptlet("require 'ruby/test.rb'");
You're asking a class in the jruby bundle to load the resource from another bundle. The problem is that jruby-complete does not know about your bundle, as it's not wired to it via normal OSGI mechanims.
So you need some form of reverse-lookup mechanism to which lets the Jruby bundle locate resources/class in other bundles, without adding a direct dependency (RequireBundle or ImportPackage) to Jruby's bundle (as that would not be scalable if you want then to be able load from other bundles, or maybe reuse jruby in other contexts).
I'm using Eclipse Equinox for a similar setup, so I'm "spoiled" with nasty treats like Buddy Policy. Apart from being specific to that container has its own disadvantages, but it's been good enough for me.
Currently one generic OSGI 'equivalent' for BuddyPolicy=Global seems to be DynamicImport-Package, however it's only there as a last resort as less flexible than the above.
Both of the above involve adding a line into Jruby bundle's Manifest (again jruby-complete.jar but I happen to repackage the whole thing as org.jruby).
A better solution is probably JRuby's own OSGiScriptingContainer, where you can pass the loading bundle into your class, something like this:
package activator;
import org.jruby.embed.OSGIScriptingContainer;
public class Main {
public void runRubySource(String[] args) {
try {
System.out.println("JRUBYYYYYYYYYYYYYYYYYYYYYYYYy");
ScriptingContainer container = new OSGIScriptingContainer(Activator.getBundle()); //
container.setArgv(args);
container.runScriptlet("require 'ruby/test.rb'");
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
}
}
I haven't tried this but I'm going to change my setup as this is seems the right way.