Spawn a process in Java that survives a JVM shutdown

后端 未结 7 1771
滥情空心
滥情空心 2020-12-10 03:40

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 sp

7条回答
  •  無奈伤痛
    2020-12-10 03:57

    I thought the whole point of Java was that it's fully contained within the JVM. It's kinda hard to run bytecode when there's no runtime.

    If you're looking to have a totally separate process you might look into trying to start a second java.exe instance. Although for your application, it might be easier to simply make a synchronized block that stops (but doesn't kill) your app, does the updating, and then re-initializes your app's data.

提交回复
热议问题