我正在尝试编写一个将代码从源文件复制到目标文件的函数。java.io.FileNotFoundException--未找到文件
copyCode("D:/rraina_IN-L0124_173"+fileName.substring(1), oldTempFile);
这是我的函数调用。
String oldTempFile = "D:/rraina_IN-L0124_173/temp/Old_" + fileName;
这是oldTempFile
这是目标。
这是函数。
private static void copyCode(String src, String destination) throws IOException {
FileChannel src1 = new FileInputStream(new File(src)).getChannel();
FileChannel dest1 = new FileOutputStream(new File(destination)).getChannel();
dest1.transferFrom(src1, 0, src1.size());
src1.close();
dest1.close();
}
然而,当我运行它,我得到的错误:
为失败 文件:/gatherer/gather/main/scripts/HartfordRetirement.javajava.io.FileNotFoundException: d:\ rraina_IN -L0124_173 \ TEMP \ Old_HartfordRetirement.java(系统 找不到指定的路径)
检查名称为Old_HartfordRetirement.java的文件存在于目录D:\ rraina_IN-L0124_173 \ temp \ ??中检查文件名称的拼写 – AJJ