I'm trying to open a directory and read its files (the directory is on a different server). I am getting an illegal escape character error on the following file assignment: java.io.File tempdirec = new java.io.File("\\servername\folder1\folder2");
The '\' is a special character in Java, used to denote special characters. For example: '\n' is the new line character (ASCII-10), '\r' is the carriage return characte (ASCII-13), '\t' is the tab character (ASCII-9), etc. So, in your code, you have an '\f' character in your string (at least that's how java interprets it), but '\f' doesn't mean anything to the compiler, so it trows that exception. To fix this, use the '\\' character, which translates to a single backslash: java.io.File tempdirec = new java.io.File("\\\\servername\\folder1\\folder2"); Note the four \s at the beginning; each blackslash that you use has to be double backslashed.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.