How do i terminate a process tree from Java?

前端 未结 5 1235
离开以前
离开以前 2021-02-05 15:26

i am using Runtime.getRuntime().exec() command in Java to start a batch file which in turn starts another process for windows platform.

javaw.exe(Process1)
 |___         


        
5条回答
  •  情深已故
    2021-02-05 16:20

    You cannot kill a process tree for windows using JDK. You need to rely on WinAPI.You'll have to resort to native commands or JNI libraries, all of which are platform-dependent and more complex than a pure Java solution would be.

    A sample link JNI Example

提交回复
热议问题