I have a Maven project structured like this:
- src/main/java/test/App.java
- src/main/resources/config/message.txt
Inside App.java, I have this line:
InputStream is = Thread.currentThread()
.getContextClassLoader()
.getResourceAsStream("/config/message.txt");
I’ve tried every variation of getting the resource that I could find on Stackoverflow and Google, but it always seems to return null when I run mvn exec:java -Dexec.mainClass=test.App. What am I missing here?
Try:
or simply: