Aleksandar Zoric Aleksandar Zoric - 6 months ago 85
Java Question

Java - Invalid File path

My application throws exception - Invalid file path. Not sure why. 'message' variable is a string that contains the name of my sub folder, which is inside 'ServerFolder'.

writer = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream("C:\\ServerFolder\\" + message + "\\" + " " + todaysDate + ".txt"), "utf-8"));


Instantiation of FileOutputStream is throwing the FileNotFoundException. Ensure that the path that you are passing in the String to FileOutputStream constructor is valid and you have permissions to create files in the directory.