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

后端 未结 3 1975
故里飘歌
故里飘歌 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:36

    You probably should use backslash instead of slash:

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

    You can also try to type double backslash:

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

提交回复
热议问题