I m working on files and trying to meke multiple files and i'm getting exception as :
java.io.IOException: The system cannot find the path specified
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(Unknown Source)
at com.create.CreatingFiles.create(CreatingFiles.java:25)
at com.create.CreatingFiles.main(CreatingFiles.java:36)
and code is :
File file = new File("F://fileIO");
        StringBuffer buffer = null;
        File newFile;
        try {
            if (!file.exists()) {
                file.mkdir();
                buffer = new StringBuffer(file.getAbsolutePath().toString());
            } else {
                System.out.println("DIRECTORY EXISTS");
                buffer = new StringBuffer(file.getAbsolutePath().toString());
            }
            for (int i = 0; i < 10; i++) {
                newFile = new File(buffer.append("/new File").append(i)
                        .append(".txt").toString());    //ERROR 
                if (!newFile.exists()) {
                    newFile.createNewFile();
                    System.out.println(newFile.getAbsolutePath());
                } else {
                    System.out.println("FILE EXISTS");
                }
            }
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
now correct me if I am wrong, i'm thinking that, i need to close file resources so that I can reassign it to new file but cannot close it.
OR
Something else is causing that error??
 
     
     
    