在Java中生成一个在JVM关闭后幸存的进程 [英] Spawn a process in Java that survives a JVM shutdown
问题描述
我需要在Java(在Linux下专门)生成一个在JVM退出后继续运行的进程。我怎样才能做到这一点?
基本上Java应用程序应该生成一个更新程序,它会停止Java应用程序,更新文件然后再次启动它。
<我对hack&如果你有一个斜杠方法让它工作以及更好的设计方案:)
如果你正在产卵使用 java.lang进行的过程。进程
它应该正常工作 - 我不相信当JVM退出时,生成的进程将会死亡。您可能会发现Ant库使您可以更轻松地控制产卵。
I need to spawn a process in Java (under Linux exclusively) that will continue to run after the JVM has exited. How can I do this?
Basically the Java app should spawn an updater which stops the Java app, updates files and then starts it again.
I'm interested in a hack & slash method to just get it working as well as a better design proposal if you have one :)
If you're spawning the process using java.lang.Process
it should "just work" - I don't believe the spawned process will die when the JVM exits. You might find that the Ant libraries make it easier for you to control the spawning though.
这篇关于在Java中生成一个在JVM关闭后幸存的进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!