Thanks to RubyForge, installing jmx4r is now as simple as typing
jruby -S gem install jmx4r
and its use is straightforward
#!/usr/bin/env jruby require 'rubygems' require 'jmx4r' # optional since by default, jmx4r tries to connect to # a JMX Server on localhost which listens to port 3000 JMX::MBean.establish_connection :host => "localhost", :port => 3000 memory = JMX::MBean.find_by_name "java.lang:type=Memory" # trigger a Garbage Collection memory.gc
However, one new feature is worth mentioning: jmx4r now supports connection authentication
JMX::MBean.establish_connection :host => "localhost", :username => "jeff", :password => "secret"
If you're using it, I'm very interested to now what you think about it.
And if you encounter any problem, do not hesitate to submit a bug.