java判断某个文件是否存在:
public static string fileexists(string plainfilepath){file file=new file(plainfilepath);if(!file.exists()) {return "false";} else{return "true";}}
file_exists,是一个函数,中文名是检查文件或目录是否存在。(如果在linux下。需要检测的父级文件夹权限不是 777 会返回false )
bool file_exists ( string filename )
如果由 filename 指定的文件或目录存在则返回 true,否则返回 false。
在 windows 中要用 //computername/share/filename 或者 \\computername\share\filename 来检查网络中的共享文件。
更多java知识请关注java基础教程。
以上就是java中怎么判断文件是否存在的详细内容。