Integrating Ruby-Processing Into An Existing Project

» 24 Jun 2008

Processing and Ruby-Processing are really awesome programs for visualizing things and making pretty doodads. Ruby-Processing is great because it uses the JRuby Java bridge to expose all of Processing’s immense power to normal Ruby code. Since I use JRuby at work for data processing anyway, Processing seemed like a natural fit for being braindead easy for drawing.

When I went to hack it into my current project I was sorely disappointed to discover that Java was squawking about SecurityExceptions and signer mismatches when run from jruby. First, how is code-signing a first-class language function? Second, this appears to be a known issue. I really hate Java.

Out of frustration, I decided to hack at it and try to recreate the jar so it would be unsigned and happy. Doing this seemed to work as I can now use Processing wherever I want in my application. If you want to use Ruby-Processing in your JRuby app, download core.jar and ruby-processing and place them wherever your other lib files live.

I created this jar by unzipping the normal ruby-processing core.jar, removing all metadata, and rebuilding it like

jar cf core.jar processing/core/*.class

This seems to work and is generating a color bar for me now.