Drawing Hands by M.C. Escher (1948)

Jeff Mesnil

Archive for March 23rd, 2007


JMX Scripts using JRuby

On March 23rd, 2007 in java, jmx, jmx4r, jruby, ruby (4 Comments »)

[update: fixed Ruby script by using ManagementFactory::newPlatformMXBeanProxy instead of MBeanServerInvocationHandler::newProxyInstance based on Daniel comment]

I needed to write a script to automate the management of a Java application using JMX which I could put in a crontab.

I found some explanation on how to script JMX in jconsole with BeanShell or with Groovy. It’s a good approach but:

It turns out that it is straightforward to write such scripts using JRuby and Java 5 or later. (more…)