Read from an ohai plugin

Hi,

I am trying to detect the java availability and the version of a node. How can I do this? Can I use ohai java plugin. If so can anyone please give me an example.

Many thanks.