FULL PRODUCT VERSION :
java version "1.4.2_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Does a file have to be closed to use setLastModified() to change its modification date?
I have a RandomAccessFile that I am writing to, but the modified time doesn't change when it is written to (is it supposed to?). I would like use setLastModified() to update the time, but it returns false unless I close the RandomAccessFile first. For example, the code below only works if I uncomment the close() below.
I am running this on WinXP, and it seems to work fine on Linux.
File file = new File("c:\\work\\", "FILETEST.txt");
RandomAccessFile raf = new RandomAccessFile(file, "rw");
System.out.println("Before=" + file.lastModified());
System.out.println("After=" + file.lastModified());
This bug can be reproduced always.