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 is I placed the file under
src/main/java/myfile.log
and
InputStream is = getClass().getClassLoader().getResourceAsStream("myfile.log"); if (is == null) { throw new FileNotFoundException("Log file not provided"); }