public static int getPID() throws IOException {
    // note that we ask Perl for "ppid" -- process ID of parent -- that's us
    String[] cmd = 
      new String[] {"perl", "-e", "print getppid() . \"\\n\";"};
    StringBuilder out = new StringBuilder();
    runShellCommand(cmd, out);
    return Integer.parseInt(out.toString());
  }
public static int getPID ( ) throws IOException { String [ ] cmd = new String [ ] { "perl" , "-e" , "print getppid() . \"\\n\";" } ; StringBuilder out = new StringBuilder ( ) ; runShellCommand ( cmd , out ) ; return Integer . parseInt ( out . toString ( ) ) ; }
Returns the process ID, via an awful hack.