Synchronization with Java through File Locks
lockf/fcntl and not
flock for synchronization through file locks with Java. When one process uses
flock and the other
lockf, then they will not be able to see each other’s locks.
Rant version: Java praises itself as being truly portable. Since 1.4 it also has a platform-independent file locking mechanism that is visible accross process boundaries and is meant for synchronization with non-Java applications .
Although the manual talks lenghtily about platform issues  it stays completey silent on the fact, that if you want to synchronize with Java you must use the
lockf/fcntl mechanism in non-Java applications in order to see Java’s file locks and in order for Java to be able to see the non-Java application’s ones.