Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Prototype some OSGi integration for jruby
branch: master


JRuby Embed OSGi

Prototype of JRuby Embed support in OSGi. Extends the jruby.embed APIs: Access classes, ruby and libraries contained in OSGi bundles.

Example: use EclipseRT Web Starter Kit to run some ruby servlets and access some java objects.

Generated p2 repository

A p2-repository is a way to publish artifacts. It supports the provisioning of products (p2-director) and compilation environments (maven-tycho). It is developped at eclipse.

The repository generated by this project contains org.jruby.jruby, org.jruby.jruby.source, org.jruby.osg and org.jruby.embed.osgi.source It is published here:

The jruby sources bundle was assembled manually. It is currently uploaded here: The org.jruby.jruby bundle is jruby-complete downloaded from maven central; unchanged.


the version 1.5.3.v20101104-nobsfimports is a repackaged jruby-complete without the bsf imports

until we figure out the PDE issue.

In particular: no DynamicImport-Package in this MANIFEST.MF

Due to a bug in Eclipse PDE the jruby-complete was repackaged: The only change is the presence of a qualifier in the version number: 1.5.3 ->

org.jruby.embed.osgi.OSGiScriptingContainer extends ScriptingContainer

Java code in an osgi bundle:

OSGiScriptingContainer container = new OSGiScriptingContainer();
container.runScriptlet(bundle, "/ruby/extend_MyClass.rb")

The bundle is lazily added to JRuby's ClassPath.

where 'extend_MyClass.rb' reads:

class Java::OrgJrubyOsgiTestSample::MyClass
  def say_hello
    puts "hello"

It is also possible to add OSGi bundles to JRuby's ClassPath from java:


require 'bundle:/'

Define ruby libraries contained in an osgi bundle:

require 'osgibundle:/org.jruby.embed.osgi.test.samplebundle'
class Java::OrgJrubyOsgiTestSamplebundle::MyOtherClass
  def say_hello_as_well
    puts "hello_as_well"

Access a ruby file inside a bundle:

require 'osgibundle:/org.jruby.embed.osgi.test/ruby/extend_MyClass.rb'

How-to build:


mvn clean integration-test

License and copyright:

The same than the jruby code.

Something went wrong with that request. Please try again.