filelock

Does the following java code guarantee and exclusive lock on an unopened file in Windows?

Does the following java code guarantee and exclusive lock on an unopened file in Windows? import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class Test { public static void main(String[] args) { File file = new File("mylog.log"); try { ...

How can I avoid file locks when updating a windows service?

I have a service that gets updated automatically by another service. The updating service downloads the latest version, shuts down the service (waiting for the stopped status), copies in new files, and starts it back up again. Lately, though, it's getting an access denied error when trying to copy the executable file. This is similar to ...