I want to read the configuration file outside the jar, how should I do?
I tried classloader.getResourceAsStream("config.xml")
and succeeded while I am running the code inside Intellij. Now I want to build the jars to a folder and place the config.xml
under the same folder, not inside the jar, but the program fails to detect the config.xml
.
Is there a graceful way of reading the config.xml
instead of using File
with relative path in the code, which doesn't work while debugging/running inside the IDE?