I am using the CSVWriter from here
String csv_path = "C:\\output.csv";
CSVWriter csv_writer = new CSVWriter(new FileWriter(csv_path));
csv_writer.writeAll(data);
csv_writer.close();
But I encounter the common exception of Access is denied
java.io.FileNotFoundException: C:\output.csv (Access is denied)
I found an accepted answer here, but it seems cant solve my problem since I am using FileWriter
.
You cannot open and read a directory, use the isFile() and isDirectory() methods to distinguish between files and folders. You can get the contents of folders using the list() and listFiles() methods (for filenames and Files respectively) you can also specify a filter that selects a subset of files listed.
I am using window 8. Is it something to do with the permission issue?