英文:
Do you need to close a process opened by Java?
问题
当当前的Java应用程序被关闭时会发生什么?换句话说,Process
是否作为守护进程运行并会自动关闭?或者,我需要调用destroy()
方法?
英文:
Consider the following:
new ProcessBuilder(pathToSomeExectuable).start();
What will happen when the current Java application will be closed? In other words, is the Process
running as daemon and will automatically closed? Or, do I need to call destroy()
?
答案1
得分: 1
[至少在Linux上] 当父进程退出时,子进程不会自动终止。
阅读以下资源以获取更多信息:
- https://stackoverflow.com/questions/395877/are-child-processes-created-with-fork-automatically-killed-when-the-parent-is
- https://stackoverflow.com/questions/261125/how-do-i-get-rid-of-java-child-processes-when-my-java-app-exits-crashes
英文:
[At least on linux] the subprocess aren't automatically terminated when the parent process exits.
Read these resources for more information:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论