public class Test {
public static void main(String[] args) {
String word="e:\\ff\\file.txt";
System.out.println(word);
System.out.println(word.replaceAll("\\\\","\\\\\\\\"));

}
}

解决方案 »

  1.   

    在程序里这么写
    string word="e:\ff\file.txt"本身就错误,那又和谈String newword="e:\\ff\\file.txt";
    的转换呢
      

  2.   

    string word="e:\ff\file.txt"可以从Jsp中的file传过来,是没问题的
      

  3.   

    private String changeString(String s) {
        String b = s.replace('\\', '/');
        return b;  }
    我想这个你应该考虑一下。
      

  4.   

    UP~~~~~~~~
    ----------------------
    《CSDN论坛新助手 CSDN's forum Explorer》
    1、更快速的浏览
    2、更方便地保存
    3、更快捷的收/发短信
    下载地址:http://www.seeyou.com.cn/CoolSlob/CSDNExplorer.exe
    更多说明:http://community.csdn.net/Expert/TopicView.asp?id=3255966