Skip to content
bcardarella edited this page Sep 12, 2010 · 14 revisions

Because Ruby-Processing uses a JARed copy of JRuby it will only look for Gems that came installed in that JAR.

It would be nice to use the power of Rubygems, so let’s tell our Sketch where to find them.

First, I would recommend installing JRuby itself, then installing all gems that you need with JRuby:

> sudo jruby -S gem install gem_name

Assuming that you have put JRuby in /usr/local/jruby all gems will install to /usr/local/jruby/lib/ruby/gems/1.8

Now, in your sketch add the following lines before you want to require a Rubygem library:

require 'rubygems'
Gem.clear_paths
ENV['GEM_HOME'] = '/usr/local/jruby/lib/ruby/gems/1.8'
ENV['GEM_PATH'] = '/usr/local/jruby/lib/ruby/gems/1.8'

This tells Rubygems to ignore all assigned paths and assume that the new path JRuby’s

Now just install as many JRuby gems as you would like.

Clone this wiki locally