Aleksandar Zoric Aleksandar Zoric - 1 year ago 205
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"));

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download