This discussion is archived
7 Replies Latest reply: Dec 22, 2011 1:53 PM by EJP RSS

Delete a file using Java

902241 Newbie
Currently Being Moderated

I have no success with my code:
File excluido = new File("teste.txt");
excluido.setWritable(true, true);
SecurityManager sm = new SecurityManager();
try {
} catch (SecurityException se) {
it throws SecurityException all the time, both on Windows and Linux.

The file teste.txt is always found, by the way.

Thank you in advance for any input.


  • Correct Answers - 10 points
  • Helpful Answers - 5 points