开发者

java exec with process replacement

开发者 https://www.devze.com 2023-03-25 21:11 出处:网络
Here is command from python: os.execvp it runs other applicat开发者_C百科ion and current process is completely replaced with new one. From script point of view, os.execvp never returns result.

Here is command from python: os.execvp it runs other applicat开发者_C百科ion and current process is completely replaced with new one. From script point of view, os.execvp never returns result.

The question is how to make the same in Java. E.g. - I have app1.class and run it. It must execute other application, but the process should be replaced.

Do you know how to make it in java?

thank you


You cannot do it in only Java. You have to spawn a new process and let the old one die.

It might be possible to create an JNI library on *nix and let it do exec for you. That would only work on unix-like operating systems. On windows you would have to spawn a new process and wait for it.

0

精彩评论

暂无评论...
验证码 换一张
取 消