I want to write a new file with the FileWriter. I use it like this:
FileWriter newJsp = new FileWriter(\"C:\\\\user\\Desktop\\dir1\\dir2\\filename.txt\"); >
Since Java 1.7 you can use Files.createFile:
Path pathToFile = Paths.get("/home/joe/foo/bar/myFile.txt"); Files.createDirectories(pathToFile.getParent()); Files.createFile(pathToFile);