Including jars with JRuby and jirb
Posted by alexd on Oct 13th, 2006
I’ve just been starting to look into JRuby - and I have to say that I like what I see!
It did take a short while to figure out how to include jars when running jirb. The include_class 'java.util.List' method works fine for built-in Java classes, but how about include_class 'my.custom.klass'?
Well, some may find this obvious, but…
You can’t use the classpath command line variable with jruby and jirb. Instead, you need to list all of the jars which your code will include in the CLASSPATH environment variable.
CLASSPATH = %CLASSPATH%;\path\to\my.jar
You can then include your class as normal, and have all your favourite Java classes available in Ruby.

