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

前端 未结 4 1723
无人及你
无人及你 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:01

    One dirty way to do it is to run your application with administrative privileges and invoke a command utility such as Handle using a ProcessBuilder.

提交回复
热议问题