Use "\\"
to escape the \ character.
I think ("\") may be causing the problem because \ is the escape character. change it to ("\\")
You can use:
\\
That's ok, for example:
if (invName.substring(j,k).equals("\\")) {
copyf=invName.substring(0,j);
}
do two \'s
"\\"
it's because it's an escape character
Source: Stackoverflow.com