Java tool/method to force-kill a child process

后端 未结 3 2023
长发绾君心
长发绾君心 2020-11-29 10:39

I am looking for a Java tool/package/library that will allow me to force-kill a child process.

This tool/package/library must work on Windows platform (mandatory).

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-29 10:52

    I had solved such problem in past using the same method you are suggesting here: use taskkill for windows and kill -9 for Unix.

    On windows you can use alternatively WMI by either invoking script (VBS or JS) from Java or using one of interoperability libraries (JaWin, Jintegra, Jinterop etc.)

    I do not think that this solution is so complicated as you are afraid. I think it is not more than 50 code lines.

    Good luck.

提交回复
热议问题