Invoking Java From Ruby

I did this using the rubygem Java-Ruby-Bridge. I did this because I was having problems with JRuby and wanted to execute my class from within Ruby.

Here is a simple way to do it, as long as you remember the classpath.

require 'rjb'
Rjb::load(classpath = '../../TestJava/bin', jvmargs=[])
test = Rjb::import('Test')
c =

This way I was able to invoke a web camera testing program written in java with a few environment variable calls

ENV['CLASSPATH'] = '../../JavaRobots/dist/javarobots.jar;../../JavaRobotsLib/jai_core.jar;../../JavaRobotsLib/jai_codec.jar'require 'rjb'test = Rjb::import('')
c ="c:\\temp\\fcover.jpg")
#default_close_operation = JFRAME::EXIT_ON_CLOSE
sleep 5