java判断路径、文件、文件夹是否存在
import java.io.File;
/**
* 判断指定路径的文件是否存在
*/
public class IsFileExists {
/**
* @param args
*/
public static void main(String[] args) {
File file = new File("D://test//behind.rar");
if (file.exists()) {
System.out.println("文件:" + file.getPath() + "|||||存在");
} else {
System.out.println("文件:" + file.getPath() + "|||||不存在!");
}
}

浙公网安备 33010602011771号