I have a Java application that uses java.nio.channels.FileLock to obtain a lock on a file. But unfortunately the API does not provide a method to determine when the lock is unsuccessful what process(es) is(are) locking the file. So I am trying to do this using JNI and C, but I have not had any luck finding source code to do this. Does anyone know how to do this? It's only necessary to work with a Windows(XP and up) environment.