Search code examples
javaeclipsebufferedreaderfilenotfoundexceptionfile-not-found

The system cannot find the path specified (java eclipse)


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?

Thank you


Solution

  • Place in Root Folder not src

    ProjectRootDir
               my.txt
               src
    

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