Hi,
I have a log file and this log file should be deleted when user clicks on a menu option.
Intially this file is opened using buffered reader as follows
BufferedReader in=new BufferedReader(new FileReader(logFilePath))
log file is read and some logic goes here.
then buffered reader is closed as follows.
finally {
try {
if (in!= null) {
//flush and close both "input" and its underlying FileReader
System.out.println("Stream has been closed");
in.close();
}
}
catch (IOException ex) {
ex.printStackTrace();
}
}
then when the user tries to delete the file, it's saying that the file can't be deleted.
Is there any problem in closing the file before deleting the file?
Can any one suggest me a way to do this.
Thanks