\\ after \ \ , which is also an escape character in regex try
String newStr = str.replaceAll("\\\\", "");
(do not forget to assign a result)
Also, if you use some string as input where a regular expression is expected, it is safer to use IMO Pattern#quote :
String newStr = str.replaceAll(Pattern.quote("\\"), "");
source share