Problem with relative file path

后端 未结 6 1921
旧时难觅i
旧时难觅i 2021-01-01 22:31

So here is my program, which works ok:

import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.Scanner;
import         


        
6条回答
  •  抹茶落季
    2021-01-01 23:05

    It must be a FileNotFoundException causing NPE in the finally block. Eclipse, by default, executes the class with the project folder (D:/java-projects/HelloWorld in your case ) as the working directory. Put the usnumbers.txt file in that folder and try. Or change the working directory in Run Configuration -> Argument tab

提交回复
热议问题