I needed to do some reflection today so I fired up interactive JRuby (jirb) to inspect a jar. Surprisingly, I couldn’t remember exactly how to use Java classes in JRuby. So I did some searching on the internet and found this to be a common question with many answers. So I figure I will document it here in case I forget how in the future.
Add it’s folder to the load path, require it, then use it!
$: << '/path/to/my/jars/' require 'myjar' # so we don't have to reference it absolutely every time (optional) include Java::com.goodercode my_object = SomeClass.new
s

