I've already looked at many other questions that are similar to mine, but unfortunately none of their answers have so far worked.
I have a Java project that looks like this:
MyProject/ src/ abc/ MyClass.java xyz/ file1.txt file2.txt ...
Essentially, I'm trying to read all of the txt files above in MyClass.java. This is what I'm currently doing:
File dir = new File("src/xyz/"); for (File child : dir.listFiles()) { ... } This works fine until I put everything into a JAR format, at which point dir.listFiles() returns null and the above no longer works. Is there anyway I can still read these txt files even when they are packed into a JAR? Also, I am using Eclipse if it makes any difference.