Java tutorial
//package com.java2s; import java.io.File; import java.io.IOException; import java.nio.channels.FileLock; public class Main { public static void freeFileLock(FileLock fl, File file) { if (file != null) { file.delete(); } if (fl != null && fl.isValid()) { try { fl.release(); } catch (IOException var3) { ; } } } }