• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need help!

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Need help!
Why I am getting 'true' for f4.exists() method invocation after calling f4.deleteOnExit()?
This code is working fine.
After running this program, I checked in the Directory for the existence of the files temp3.txt and temp4.txt. Both are not available, I know because I am calling the deleteOnExit() and delete() method.
API says that public void deleteOnExit() Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates.
Is this means still the file pathname can exist? Sorry I am not able to understand this.

 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The API says, "Requests that the file or directory denoted by this abstract pathname be deleted when the virtual machine terminates. Deletion will be attempted only for normal termination of the virtual machine, as defined by the Java Language Specification (12.9). "
This means that when the JVM terminates it will do the delete. The JVM terminates when all programs using it have terminated. As you have seen, after your program is finished the delete has been done.
 
Johnson K Jose
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Thomas Paul
Why I am getting 'true' for f4.exists() method invocation after calling f4.deleteOnExit()?
please give me some more info.
Regards
Johnson :roll:
 
Thomas Paul
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Because the file hasn't been deleted!!! It doesn't get deleted until after every program including yours that is running in this JVM is finsished. If you want to delete it right now then use delete().
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
f4.deleteOnExit()
This seems like it would delete f4 when you exit, not when you call the method.
[ October 10, 2002: Message edited by: Marilyn de Queiroz ]
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had this problem sometime ago. Can't remember
where I posted it though. The file did not get deleted after the program had exited. This only
occurred on DOS derivatives (Win-anything).
On Linux/Solaris it worked ok.
-Barry
 
Johnson K Jose
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear friends,
Sorry for the delay. Thanks a lot for the information
Regards
Johnson
 
reply
    Bookmark Topic Watch Topic
  • New Topic