I'm making a Java program consisting of a folder containing my JAR and an end-user config file. I need to access the config file "conf" programmatically, what are the best practices for doing so?
My current solution consists of changing the class-path in Manifest.mf to "../", pointing to the parent-folder of JAR where the adjacent file is located. Then I call {myMainClass}.getClass().getResource("/conf")
to get the URL and work my way from there. The whole class-path thing feels a bit hacky, is there any better or more elegant way of doing this? The root application should be portable so I would like a config-location/path relative to the JAR.