Java: Get a process given a pid

Viewed 6151

Say I have a current running process known, how can I turn this into a Process object in Java? The process is already running, so I don't want to spawn off another one, I just want to encapsulate it into a Process object that I can use within the java code. Something along the lines of:

int pid = getPid();
Process proc = magicGetProcess(pid);

thanks

4 Answers

what about using RMI? It it possible to pass a Process object to the Process which it is? Probably not, because Process is not Serializable

Related