How to read a file that is located in the project folder java

后端 未结 3 1992
故里飘歌
故里飘歌 2021-01-27 19:07

Using eclipse, I have a file titled bad_words.txt in my project folder titled HackGSU. I want locate the file and read the contents of the file. I saw this answer how to read te

3条回答
  •  滥情空心
    2021-01-27 19:50

    Looking at the error it doesn't look like you are getting the full path. Instead of

    p.concat("/HackGSU/bad_words.txt");
    

    Try

    p = p.concat("/HackGSU/bad_words.txt");
    

提交回复
热议问题