code: 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());
    }
docs: Returns the process ID, via an awful hack.