使用以下代码在 Windows 7 中删除文件时遇到一些问题:
private static final String WIN_DIR_TEST = "D:"+File.separator+"Users"+File.separator+"u119255"+File.separator+"Desktop"+File.separator;
...
File file = null;
FileWriter fileWriter = null;
String localPath = WIN_DIR_TEST.concat("abc.degno");
file = new File(localPath);
fileWriter = new FileWriter(file, true);
fileWriter.write("qwertyuiop\n");
fileWriter.close();
ftp.send(localPath, distantPath);
file.delete();
最后一行总是返回 false,我不明白为什么。此外,不会发生异常。