I just wrote a complete example, including all required source code and a Makefile on my AI blog.

JRuby continues to please me: fantastic to be able to switch from C-Ruby to JRuby when I need to use large existing Java libraries.