tags:

views:

839

answers:

2

I know that using File object we can get the last modified time for a File. But, my requirement is to get the last accessed time for a file in Java. How do I get it?

+2  A: 

You can't do it with plain Java, you'll need to use JNI to access the platform specific data, such as this.

Kris
+4  A: 

You will need to wait for NIO2, which should come with Java 7. It has a method lastAccessTime() for reading the last access time.

Esko Luontola