我正在尝试使用java.nio.file.Files复制文件,如下所示:
Files.copy(cfgFilePath, strTarget, StandardCopyOption.REPLACE_EXISTING);
Run Code Online (Sandbox Code Playgroud)
问题是Eclipse说"文件类型中的方法副本(Path,Path,CopyOption ...)不适用于参数(File,String,StandardCopyOption)"
我在Win7 x64上使用Eclipse和Java 7.我的项目设置为使用Java 1.6兼容性.
有没有解决方案,或者我必须创建这样的解决方法:
File temp = new File(target);
if(temp.exists())
temp.delete();
Run Code Online (Sandbox Code Playgroud)
谢谢.