LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-07-2005, 01:18 AM   #1
poeta_boy
Member
 
Registered: Oct 2003
Location: Mexico
Distribution: Ubuntu
Posts: 223

Rep: Reputation: 31
erasing a file with java


Hello everyone:

I know I can create a file with java, and write there, but is there a way for me to erase a file too?

My question is because I need to create a temp file, where to store some info, and then (when the program ends) erase it, so I don't create a mess in the directory

is that possible?

thanks a lot

Poeta
 
Old 05-07-2005, 01:34 AM   #2
kencaz
Senior Member
 
Registered: Mar 2005
Location: Las Vegas, NV
Distribution: Mandriva Slackware FreeBSD
Posts: 1,468

Rep: Reputation: 48
I'm not a Java programmer, however, I would not want Java having the capability of erasing files on my system... I have it turned of anyway. I am sure there is probably a way though...

KC
 
Old 05-07-2005, 01:53 AM   #3
vladmihaisima
Member
 
Registered: Oct 2002
Location: Delft, Netherlands
Distribution: Gentoo
Posts: 196

Rep: Reputation: 33
You can use:

File f=new File("temp");
f.delete(); // returns boolean if it succeded

Of course there could be a security exception depending of the security manager and the rights the program has (for a standalone application there is none - so no exception, but for applets threre are securitymanagers by default).
 
Old 05-07-2005, 10:09 AM   #4
poeta_boy
Member
 
Registered: Oct 2003
Location: Mexico
Distribution: Ubuntu
Posts: 223

Original Poster
Rep: Reputation: 31
thanks a lot.... It's an standalone, so there should be no problem...

thanks =)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
erasing the MBR in linux TheOneAndOnlySM Linux - General 5 02-15-2005 07:48 AM
erasing /tmp on start up... perry Linux - General 18 08-12-2004 11:35 AM
Erasing history Menestrel Linux - Newbie 1 05-11-2004 02:23 PM
Help Erasing Linux DarthPip Linux - Software 7 03-21-2004 01:48 PM
HD erasing and installing sky78 Linux - Newbie 2 08-25-2003 03:04 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration