diff --git a/bindings/java/src/net/hyperic/sigar/cmd/Ps.java b/bindings/java/src/net/hyperic/sigar/cmd/Ps.java index 99bdf972..205da2d8 100644 --- a/bindings/java/src/net/hyperic/sigar/cmd/Ps.java +++ b/bindings/java/src/net/hyperic/sigar/cmd/Ps.java @@ -8,11 +8,16 @@ import net.hyperic.sigar.ProcMem; import net.hyperic.sigar.ProcTime; import net.hyperic.sigar.ProcState; +import java.io.File; +import java.io.IOException; + import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.jar.Attributes; +import java.util.jar.JarFile; /** * Show process status. @@ -89,6 +94,51 @@ public class Ps extends SigarCommandBase { return true; } + //try to guess classname for java programs + public static String getJavaMainClass(SigarProxy sigar, long pid) + throws SigarException { + + String[] args = sigar.getProcArgs(pid); + for (int i=1; i