现在,我试图将文件和文件夹从一个目录移动到我的桌面。以下是我的代码:
import java.nio.file.*;
import java.nio.FileUtils;
class CopyDirectoryApache {
public static void main(String[] args) throws IOException {
File sourceLocation = new File("/home/jakobcurrin/minecraft/mods/");
File targetLocation = new File("/home/jakobcurrin/desktop/");
FileUtils.copyDirectory(sourceLocation, targetLocation);
}
}
Main.java:6: error: class CopyDirectory is public, should be declared in a
file named CopyDirectory.java
public class CopyDirectory
^
Main.java:3: error: cannot find symbol
import java.nio.FileUtils;
^
symbol: class FileUtils
location: package java.nio
2 errors
我调试了代码,但它一直显示“找不到符号”。我该如何解决?如果您能详细解释一下,那就太好了。
import java.nio.FileUtils
。这看起来正确吗@JustAProgrammer? - Lunar