diff --git a/bindings/java/src/org/hyperic/sigar/cmd/Mx.java b/bindings/java/src/org/hyperic/sigar/cmd/Mx.java index 554fddf9..642464ae 100644 --- a/bindings/java/src/org/hyperic/sigar/cmd/Mx.java +++ b/bindings/java/src/org/hyperic/sigar/cmd/Mx.java @@ -79,18 +79,38 @@ public class Mx extends SigarCommandBase { } } + private void jconsole() { + String pid = String.valueOf(this.sigar.getPid()); + String[] argv = { "jconsole", pid }; + println("exec(jconsole, " + pid + ")"); + try { + Process p = Runtime.getRuntime().exec(argv); + p.waitFor(); + println("jconsole exited"); + } catch (Exception e) { + println(e.getMessage()); + } + } + public void output(String[] args) throws SigarException { MBeanServer server = getMBeanServer(); register(server); - boolean hasQuery = args.length != 0; - try { - String query; - if (hasQuery) { - query = args[0]; + boolean hasQuery = false; + boolean launchJconsole = false; + String query = "sigar:*"; + + for (int i=0; i