我在netbeans中创建了一个桌面项目,在项目文件夹中我有三个文件:file.txt,file2.txt和file3.txt,在程序的加载中我想调用这三个文件,这是我试过的代码:
public void run() {
Path path = Paths.get("file.txt");
Path path2 = Paths.get("file2.txt");
Path path3 = Paths.get("file3.txt");
if(Files.exists(path) && Files.exists(path2) && Files.exists(path3)) {
lireFichiers();
}else{
JOptionPane.showConfirmDialog(null, "Files didn't found !");
}
}
但是当我运行我的程序时,我收到消息:"Files didn't found !"
这意味着他没有找到那些文件。
这些文件是由这段代码创建的:
File file = new File("Id.txt");
File file2 = new File("Pass.txt");
File file3 = new File("Remember.txt");