how to read text file relative path

后端 未结 4 2173
迷失自我
迷失自我 2021-02-20 01:57

I have read sources here & there, but did not get the following code working. Basically, I wish to read a text file, named \'Administrator\' from the folder \'src\'. I will

4条回答
  •  面向向阳花
    2021-02-20 02:32

    This is not correct:

    new FileReader(getClass().getResourceAsStream ("/DBTextFiles/Administrator.txt"))
    

    You want:

    new InputStreamReader(getClass().getResourceAsStream ("/DBTextFiles/Administrator.txt"))
    

提交回复
热议问题