Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: NIO
-
Labels:None
-
Number of attachments :
Description
Path file = Paths.get("C:/Temp/my.test");
DirectNIOBuffer buffer = new DirectNIOBuffer(file.toFile());
Files.deleteIfExists(file);
// the Files.deleteIfExists throws the following exception
// java.nio.file.FileSystemException: C:\Temp\my.test: The process cannot access the file because it is being used by another process.
// at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86)
// at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
// at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
// at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:268)
// at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
// at java.nio.file.Files.deleteIfExists(Files.java:1110)
// at test.MyTest.run(MyTest.java:28)
// at test.MyTest.main(MyTest.java:41)
Warren,
I think you'll find this a windows problem:
http://docs.codehaus.org/display/JETTY/Files+locked+on+Windows
See also this Sun bug:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4715154
Jan