I\'m loading a text file from within a package in a compiled JAR of my Java project. The relevant directory structure is as follows:
/src/initialization/Life
What worked for me was to add the file under My Project/Java Resources/src and then use
My Project/Java Resources/src
this.getClass().getClassLoader().getResourceAsStream("myfile.txt");
I didn't need to explicitly add this file to the path (adding it to /src does that apparently)
/src