0

How to get Runtime and PID with a process? In my application I start the Process with ProcessBuilder like this:

    ProcessBuilder processBuilder = new ProcessBuilder(rgumentsList).toArray(new String[argumentsList.size()]));
processBuilder.redirectErrorStream(true);
processBuilder.directory(getInstanceMainDir());
instanceProcess = processBuilder.start();

How do I get instanceProcess's Runtime and PID? I need Runtime to check the memory used by this app and PID to check used CPU.

Sentry
  • 4,102
  • 2
  • 30
  • 38
Larry
  • 101
  • 9
  • 1
    It's okay! Here on Stack Overflow, your English can be as terrible as you want and as long as it's comprehensible, [somebody will edit it](http://stackoverflow.com/suggested-edits/2655568) to make it better :) – Nissa Aug 06 '16 at 22:50
  • i saw this thread: http://stackoverflow.com/questions/7834270/how-do-i-obtain-the-pid-of-a-spawned-java-process but how to get Runtime and pid when i know only start Command, i don't know app name etc. – Larry Aug 06 '16 at 22:58

0 Answers0