开发者

How to suspend/resume a process created by ProcessBuilder in Java

开发者 https://www.devze.com 2023-02-28 23:10 出处:网络
ProcessBuilder.start() returns a Process object through which I can access the 3 streams (STDIN, STDERR, STDOUT) of the new process.

ProcessBuilder.start() returns a Process object through which I can access the 3 streams (STDIN, STDERR, STDOUT) of the new process.

Unfortunately, I couldn't find a way to access the process id of the created process through the Process interface. Is there a way to access the process开发者_Go百科 id?

Beyond this, I wished to do something like calling SuspendProcess() and ResumeProcess() [Win32 APIs]

Is there a way to do these things in Java?


There isn't one. If you are in control of the started process you could have it read its stdin for stop/start messages, and write them from the starting Java code via Process.getOutputStream().


Maybe this could help you.
How can a Java program get its own process ID?

0

精彩评论

暂无评论...
验证码 换一张
取 消