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 |
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 |
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). |
thanks a lot.... It's an standalone, so there should be no problem...
thanks =) |
All times are GMT -5. The time now is 04:10 PM. |