java - Save Excel file from being deleted/ make it protected -


i have requirement in excel generated in c: folder through apache poi , want if user forcefully try delete going location selecting mouse , hitting delete key particular excel not need deleted , want make protected 1 , please let me know how through java code can make excel file not deleted one, setting in apache poi

take on discussion: how can lock file using java (if possible)

shortly speaking use channel lock following:

filelock lock = new fileinputstream(paht).getchannel().lock(); try {    // need } {     lock.release(); } 

or better using new feature of java 7:

try (     filelock lock = new fileinputstream(paht).getchannel().lock(); ) {    // need } // file lock autoclosable, there no need call release() explicitly 

Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -