}
public static ProcessStateCode getProcessState(String processId) throws Exception {
if (OS_NAME.equals("Mac OS X") || OS_NAME.equals("Linux")) {
ExternalCommand cmd = ExternalCommand.start("ps", processId);
cmd.waitFor();
// split by new lines
// should return 2 lines for an existing process, or 1 line for a non-existing process
String lines[] = cmd.getStringOutput().split("[\\r\\n]+");
if (lines.length != 2) {