java exec with process replacement
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.
精彩评论