Java: get a process with a given PID
•
Java
Say I have a currently running process known, how can I convert it into a process object in Java?
int pid = getPid(); Process proc = magicGetProcess(pid);
thank you
Solution
I don't think this can only use built-in libraries AFAIK, it is extraordinary to obtain the PID of the running process (see feature request and alternate mechanisms)
Quick browse Java Lang. process class shows that you can use JNI and native code to write custom Java Lang. process implementation Your custom class can implement additional methods, such as your problem
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码