Suspend a child process spawned by java

天大地大妈咪最大 提交于 2019-12-24 15:27:46

问题


I have a java program which uses Runtime.exec() to spawn a child process, but I need to be able to programatically suspend it and then start it running again from where it left off. The Java Process object doesn't seem to provide any way to do that. Does anyone know how I might accomplish this?

Thank you


回答1:


Under UNIX you can Runtime.exec + kill -STOP and -CONT to suspend and resume a process, without using JNI.




回答2:


Java is not a low level language. Thus, some interactions with the Operating System are not supported.

The only solution is for you to create your code using a language which can really work with the OS such C/C++ and call it from java using JNI.



来源:https://stackoverflow.com/questions/14248484/suspend-a-child-process-spawned-by-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!