as execute in command line:f:\>java -r \\f:\temp\hello.txt \\f:\temp\123.txt你好好检查一下语法正确吗???

解决方案 »

  1.   

    public boolean renameTo(File dest)
    Renames the file denoted by this abstract pathname. 
    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. 
    Parameters:
    dest - The new abstract pathname for the named file 
    Returns:
    true if and only if the renaming succeeded; false otherwise 
    Throws: 
    SecurityException - If a security manager exists and its SecurityManager.checkWrite(java.lang.String) method denies write access to either the old or new pathnames 
    NullPointerException - If parameter dest is null
    上面是从javadoc中copy的,你认真看一看renameTo方法对变量的要求!!!!
      

  2.   

    你写的有错误,改为下:
    f:\>java -r f:/temp/hello.txt f:/temp/123.txt