Should work in Windows:
File file = new File("file.txt");
boolean fileIsNotLocked = file.renameTo(file);
More Related Contents:
- Why is volatile used in double checked locking
- Is there an advantage to use a Synchronized Method instead of a Synchronized Block?
- Do spurious wakeups in Java actually happen?
- Java synchronized method lock on object, or method?
- Simple Java name based locks?
- Java Synchronized Block for .class
- Static versus non-static lock object in synchronized block
- How to solve the “Double-Checked Locking is Broken” Declaration in Java?
- What is the difference between synchronized on lockObject and using this as the lock?
- Distributed Lock Service [closed]
- Java Concurrency: CAS vs Locking [closed]
- How does FileLock work?
- Java : Does wait() release lock from synchronized block
- How to acquire a lock by a key
- Threads – Why a Lock has to be followed by try and finally
- If a synchronized method calls another non-synchronized method, is there a lock on the non-synchronized method
- ReentrantReadWriteLock: what’s the difference between ReadLock and WriteLock?
- How to create exception from another class
- How can I disable GPS/WiFi for all Android apps but one I’m crerating?
- How to return multiple objects from a Java method?
- Determine if a String is an Integer in Java [duplicate]
- JavaFX 11: IllegalAccessError when creating Label
- How do I create an .exe for a Java program? [duplicate]
- How to split a string, but also keep the delimiters?
- java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property
- Executing another application from Java
- When would you use a WeakHashMap or a WeakReference?
- Streaming large files in a java servlet
- How to convert .pfx file to keystore with private key?
- Is there a way to get the value of a HashMap randomly in Java?