删除文件或目录
import java.nio.file.Files;/* from N o w J a v a . c o m*/ import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void main(String[] args) throws Exception { Path sourceFile = Paths.get("C:/home/docs/users.txt"); Files.delete(sourceFile); } }