如文件名b_L1ON_0.txt.我有时能改有时不能。

解决方案 »

  1.   

    这是JDK文档中的原话:
    Whether or not this method can move a file from one filesystem to another is platform-dependent. The return value should always be checked to make sure that the rename operation was successful.
    看样子,JDK并不能保证renameTo方法一定能够成功
      

  2.   

    嘿嘿,在java中,我建议:任何命名,包括主机名,文件名,等等。尽量不要使用下划线,否则,有可能碰到一些莫名其妙的问题,exception之类的东东!我曾经被这个折磨惨
      

  3.   

    可能是rename的目的文件已经存在.