У меня есть следующий код для чтения текстового файла.
public static void main(String[] args)
{
try
{
Scanner in = new Scanner(new FileReader("input.txt"));
while(in.hasNext())
{
System.out.println(in.next());
}
}
catch (FileNotFoundException ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
У меня есть структура моего проекта, настроенная следующим образом:
build/ directory contains class
dist/ directory contains the jar file
src/ directory contains source
input.txt the text file to read
Если я поместил свой текстовый файл input.txt в каталог с именем test, который имеет тот же каталог, что и build, dist и src, что должно войти в параметр filereader, чтобы Я все еще могу найти этот файл?