The system cannot find the path specified with FileWriter

Posted by Nazgulled on Stack Overflow See other posts from Stack Overflow or by Nazgulled
Published on 2010-05-24T15:41:53Z Indexed on 2010/05/24 16:01 UTC
Read the original article Hit count: 319

Filed under:
|
|

Hi,

I have this code:

private static void saveMetricsToCSV(String fileName, double[] metrics) {
        try {
            FileWriter fWriter = new FileWriter(
                    System.getProperty("user.dir") + "\\output\\" +
                    fileTimestamp + "_" + fileDBSize + "-" + fileName + ".csv"
            );

            BufferedWriter csvFile = new BufferedWriter(fWriter);

            for(int i = 0; i < 4; i++) {
                for(int j = 0; j < 5; j++) {
                    csvFile.write(String.format("%,10f;", metrics[i+j]));
                }

                csvFile.write(System.getProperty("line.separator"));
            }

            csvFile.close();
        } catch(IOException e) {
            System.out.println(e.getMessage());
        }
    }

But I get this error:

C:\Users\Nazgulled\Documents\Workspace\Só Amigos\output\1274715228419_5000-List-ImportDatabase.csv (The system cannot find the path specified)

Any idea why?

I'm using NetBeans on Windows 7 if it matters...

© Stack Overflow or respective owner

Related posts about java

Related posts about filewriter