title: Force java to release all file locks/handles in Java
body: <p>My Java application (which is quite a bit of code) does a lot of file operations. At one point in my application, I need to move a file from one location to another and for this I'm using the <code>Files.move</code> method from JDK7. </p>
  
  <p>When I try to do this, I get an error telling me that the file is in use. I know for a fact that it's some part of my code that is locking this resource. </p>
  
  <p>How I force my Java application to release all locks prior to calling the function that moves/renames my file?</p>
  
  <p>If this is not possible, is there an easy way to check which part of my code is locking the file? Trudging through my whole codebase to find unclosed file handles would be a nightmare considering the amount of code there is.</p>
  
  <p>Thanks</p>