复制文件
import java.io.IOException; import java.nio.file.FileSystem;/*来 自 时 代 Java 公 众 号 - nowjava.com*/ import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; public class Main { public static void main(String[] args) { FileSystem fileSystem = FileSystems.getDefault(); System.out.println("FileSystem:" + fileSystem); Path sourcePath = fileSystem.getPath("file.log"); Path targetPath = fileSystem.getPath("file2.log"); System.out.println("Copy from " + sourcePath.toAbsolutePath().toString() //nowjava.com 提 供 + " to " + targetPath.toAbsolutePath().toString(