0

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

Theriotgames Riot
  • 333
  • 3
  • 6
  • 14

1 Answers1

2

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

Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720
  • Well that did it, thank you really much, but is there any reason it didn't work when I put \src\file ? – Theriotgames Riot Nov 10 '13 at 18:37
  • 1
    Yes, because if you run from ecplise, the programs searches from the root directory, and if you're running from command line, the program search the same directory the binary file (.class) is in. You could always change the String path you're using if you want to place the file somewhere else. Please accept if this worked for you. Thanks! Glad I could help – Paul Samsotha Nov 10 '13 at 18:39
  • I have to wait 10 minutes before accepting as answer for some reason, but I will do it don't worry ;) – Theriotgames Riot Nov 10 '13 at 18:40