Thursday, May 21, 2015

SOLVED : Java - filepath - Invalid escape sequence

It's a compile-time error, so it can't be to do with permissions etc.
The problem is that you're not escaping the backslashes. You need:
String filePath = request.getRealPath("\\\\10.0.1.18\\downloads\\upload)";
Then the contents of the string will be just
\\10.0.1.18\downloads\upload
This is exactly the same as in the first line you showed, where this:
String filePath = "D:\\location";
... will actually create a string with contents of:
D:\location

No comments:

Post a Comment