Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在FileReader r=new FileReader中键入文件路径(“如何获取文件路径”);_Java_Exception_Filereader_Filenotfoundexception - Fatal编程技术网

Java 如何在FileReader r=new FileReader中键入文件路径(“如何获取文件路径”);

Java 如何在FileReader r=new FileReader中键入文件路径(“如何获取文件路径”);,java,exception,filereader,filenotfoundexception,Java,Exception,Filereader,Filenotfoundexception,我无法理解如何写文件名。因为它总是显示FileNotFoundException 我在IntelliJ上有一个名为topnote.txt的文件。但即使我放置文件的路径,也找不到它。执行以下命令以了解应用程序根所在的位置,然后相对于该位置引用该文件: System.out.println(new java.io.File("test-file-name-this-wont-be-created").getAbsolutePath()); 大家好,欢迎来到SO。你能添加代码的相关部分吗?我知道,但

我无法理解如何写文件名。因为它总是显示FileNotFoundException


我在IntelliJ上有一个名为topnote.txt的文件。但即使我放置文件的路径,也找不到它。

执行以下命令以了解应用程序根所在的位置,然后相对于该位置引用该文件:

System.out.println(new java.io.File("test-file-name-this-wont-be-created").getAbsolutePath());

大家好,欢迎来到SO。你能添加代码的相关部分吗?我知道,但问题是它根本找不到。