943,923 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Marked Solved
  • Views: 6162
  • Java RSS
Dec 9th, 2008
0

Get File creation Date

Expand Post »
Hi is there a way of getting a file creation Date for a file class object?

I am trying to do so on a mac.

Many thanks
Similar Threads
Reputation Points: 14
Solved Threads: 0
Junior Poster in Training
Grub is offline Offline
60 posts
since Oct 2007
Dec 9th, 2008
0

Re: Get File creation Date

well...
since there are certain OS' that do not "remember" the creation date of a file, I doubht Java has a standard sollution for this.
At least not one I've come accross to
Reputation Points: 935
Solved Threads: 356
Nearly a Posting Maven
stultuske is offline Offline
2,497 posts
since Jan 2007
Dec 9th, 2008
0

Re: Get File creation Date

No, at least not when using the standard library because in *nix, the creation time isn't stored anywhere. If you are running on a windows box, you have two options:
- spawn a shell process which fires the command 'dir /a' and extract the creation time [easiest]
- Use JNI, maybe something like FileTimes library
Last edited by ~s.o.s~; Dec 9th, 2008 at 11:44 am.
Super Moderator
Featured Poster
Reputation Points: 3233
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,871 posts
since Jun 2006
Dec 9th, 2008
0

Re: Get File creation Date

Click to Expand / Collapse  Quote originally posted by ~s.o.s~ ...
If you are running on a windows box,
Windwos on a Mac? Blasphemy
Reputation Points: 935
Solved Threads: 356
Nearly a Posting Maven
stultuske is offline Offline
2,497 posts
since Jan 2007
Dec 9th, 2008
0

Re: Get File creation Date

Ah, this is what I get for posting a reply based on the thread title. :-)
Super Moderator
Featured Poster
Reputation Points: 3233
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,871 posts
since Jun 2006
Dec 9th, 2008
0

Re: Get File creation Date

Many thanks for the replies.

I have tried this

String creationDate = NativeInterface.nativeFileCreationDate(file.getAbsolutePath()); return creationDate;
it then throws a : "java.lang.NoClassDefFoundError"

Is there any other means to do so on the mac or am I doing this wrong?

Many thanks again.
Reputation Points: 14
Solved Threads: 0
Junior Poster in Training
Grub is offline Offline
60 posts
since Oct 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: reading a part of a txt file
Next Thread in Java Forum Timeline: validating password





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC