How can I tell what processes are using a file under Java in Windows?

前端 未结 4 1742
无人及你
无人及你 2021-02-14 04:40

We have a scheduled task written in Java that is failing on Windows platforms because sometimes the files it needs to delete are still in use. Is there a way from within Java t

4条回答
  •  故里飘歌
    2021-02-14 05:07

    I asked a similar question on Github for the JNA project and @matthiasblaesing wrote a code to accomplish this.

    The code is here.

    It prints a list with all the running processes in the format: : : .

提交回复
热议问题