Get File creation Date

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Oct 2007
Posts: 60
Reputation: Grub is an unknown quantity at this point 
Solved Threads: 0
Grub Grub is offline Offline
Junior Poster in Training

Get File creation Date

 
0
  #1
Dec 9th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 706
Reputation: stultuske is a jewel in the rough stultuske is a jewel in the rough stultuske is a jewel in the rough 
Solved Threads: 84
stultuske's Avatar
stultuske stultuske is offline Offline
Master Poster

Re: Get File creation Date

 
0
  #2
Dec 9th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,652
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 474
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: Get File creation Date

 
0
  #3
Dec 9th, 2008
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.
I don't accept change; I don't deserve to live.

Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 706
Reputation: stultuske is a jewel in the rough stultuske is a jewel in the rough stultuske is a jewel in the rough 
Solved Threads: 84
stultuske's Avatar
stultuske stultuske is offline Offline
Master Poster

Re: Get File creation Date

 
0
  #4
Dec 9th, 2008
Originally Posted by ~s.o.s~ View Post
If you are running on a windows box,
Windwos on a Mac? Blasphemy
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,652
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 474
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: Get File creation Date

 
0
  #5
Dec 9th, 2008
Ah, this is what I get for posting a reply based on the thread title. :-)
I don't accept change; I don't deserve to live.

Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 60
Reputation: Grub is an unknown quantity at this point 
Solved Threads: 0
Grub Grub is offline Offline
Junior Poster in Training

Re: Get File creation Date

 
0
  #6
Dec 9th, 2008
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.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum


Views: 3171 | Replies: 5
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC