系统找不到指定的路径(java eclipse)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19893434/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 21:06:09  来源:igfitidea点击:

The system cannot find the path specified (java eclipse)

javaeclipsebufferedreaderfilenotfoundexceptionfile-not-found

提问by Theriotgames Riot

I'm not coing to copy paste all my code, but here's the line where I get the error :

我不打算复制粘贴我的所有代码,但这是我收到错误的那一行:

try {
    BufferedReader in = new BufferedReader(new FileReader(args[0]));
}

catch(IOException e) {
    System.out.println(e);
}

In the run configuration, I've set the argument as "file" (the name of my file which is simply a file type), but I always get this error : "The system cannot find the path specified".

在运行配置中,我将参数设置为“文件”(我的文件的名称,它只是一种文件类型),但我总是收到此错误:“系统找不到指定的路径”。

My file is located in the src folder, and I already tried to put \src\file in my argument and it still didn't work. Is there any way to resolve this error?

我的文件位于 src 文件夹中,并且我已经尝试将 \src\file 放在我的参数中,但它仍然不起作用。有没有办法解决这个错误?

Thank you

谢谢

采纳答案by Paul Samsotha

Place in Root Folder not src

放在根文件夹而不是 src

ProjectRootDir
           my.txt
           src

If you're running from command line, you may need to place in the binfolder

如果您从命令行运行,则可能需要放置在bin文件夹中