There is a code

BufferedReader reader = null; try { reader = new BufferedReader( new InputStreamReader(new FileInputStream("input.txt"))); } catch (FileNotFoundException e1) { System.out.println("Файл не найден"); System.exit(0); } 

Question: where should I put the file input.txt , so that it is considered correctly?

    2 answers 2

    it is better to correctly specify the path, for example, C: // input.txt , and by default to the project directory

    • Once upon a time I had through netscape trying to find c: \ autoexec.bat on the linux section. It looked funny ... And they say that java is platform-independent. - alexlz

    In order not to specify the full path, but only the name of the file - this file should be in the project directory.