[英]Java file.exists() can't find an XML file
我只是试图查找XML文件是否存在。 我有以下代码:
File f = new File("customers/jim.xml");
File g = new File("customers/jim.txt");
if(f.exists())
{
System.out.println("File f exists!");
}
else
{
System.out.println("File f not found!");
}
if(g.exists())
{
System.out.println("File g exists!");
}
else
{
System.out.println("File g not found!");
}
输出:
File f not found!
File g exists!
找到该文本文件,而找不到xml。 这两个文件都在同一个文件夹中,并且拼写确实正确。 有人知道我在做什么错吗?
一切看起来正确,因此需要检查以下几件事:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.