I'm having a problem in deleting a specific file in a folder, This is what I want to happen:
I want to delete a file, having the file name of..
This is my code by the way:
try
{
File f=new File("C://Generated Barcodes//"+file_copy.getText()+".png");//full path like c:/home/ri
if(!f.exists())
{
JOptionPane.showMessageDialog(null, "Something Went Wrong!",
" ", JOptionPane.ERROR_MESSAGE);
}
else
{
f.delete();
}
} catch(Exception e) {
e.printStackTrace();
}
can anyone help me out on how to do it.? It did not delete the file actually. And I guess, the delete() there, doesn't do anything. Your help is highly appreciated.
Aucun commentaire:
Enregistrer un commentaire