# Java: How to Delete Dat Files



## systemErr (Apr 18, 2008)

Hi,

I am using Windows XP Home Edition and I am writing a program that will delete index.dat files. I keep getting various and random error messages when I try to delete a dat file. How can I accomplish this in Java, especially without restarting the machine?

I try something like:

String path = "c:\\documents and settings\\user\\cookies\\index.dat";
File f = new File(path);
f.delete();


----------

