I am writing huge ammount of data in CSV file. If i open the excel file in 'Read only' or 'Notify' mode, my java program gives Exception as
java.io.IOException: The process cannot access the file because another process has locked a portion of the file
This should be case as opening excel is not locking any thing for writing.
What i am doing is some thing like this,
String wd = System.getProperty("user.dir");
JFileChooser fc = new JFileChooser(wd);
int rc = fc.showDialog(null, "Save File As");
if (rc == JFileChooser.APPROVE_OPTION)
File file = fc.getSelectedFile();
String strNewFileName = file.getAbsolutePath() + "." + "csv";
File newfile = new File(strNewFileName);
Writer output = new BufferedWriter(new FileWriter(newfile));
// fetch data from database
What should be cause for this?
Appriciate your help..
Edited by: charuta on Dec 10, 2008 3:40 AM
You can't have a file open in two processes in windows, ever... it's a facet of windows "simple file sharing".... which is not simple, and does not allow files to be shared.
It is my considered opinion that Bill Gates should be publicly flogged to death with a fluffy pink shoelace.