random technical thoughts from the Nominet technical team

Including jars with JRuby and jirb

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
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.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

Recent Posts

Highest Rated

Categories

Archives

Meta: