Where to put a textfile I want to use in eclipse?

后端 未结 9 636
误落风尘
误落风尘 2020-11-30 02:31

I need to read a text file when I start my program. I\'m using eclipse and started a new java project. In my project folder I got the \"src\" folder and the standard \"JRE S

9条回答
  •  借酒劲吻你
    2020-11-30 03:15

    Depending on your Java class package name, you're probably 4 or 5 levels down the directory structure.

    If your Java class package is, for example, com.stackoverflow.project, then your class is located at src/com/stackoverflow/project.

    You can either move up the directory structure with multiple ../, or you can move the text file to the same package as your class. It would be easier to move the text file.

提交回复
热议问题