I\'m using FlatPack to parse and load data from flat files. This requires loading a config file that stores mappings of the columns of the flat file.
I have a const
If I remember correctly, getResourceAsStream() can behave differently depending on which web server your webapp is deployed, for instance I think it can be a problem when deployed as a war on a Websphere instance. But I'm not sure if this applies to you.
But I'm not sure you're trying to solve the "proper" problem : if it's a config file, that means is data dependant right ? Not code dependant ( your jar ) ? When the flat file will change, your config file will need to change as well, right ? If this is true, it sounds like the config should be better stored elsewhere, or even passed as a parameter to your jar.
But maybe I haven't fully understood your problem...
Use Apache Commons Configuration, then you can read/write XML, auto update, find config file in path or jar, without a lot of hassles.
I think it is solved just here:
http://www.velocityreviews.com/forums/t129474-beginner-question-how-to-access-an-xml-file-inside-a-jar-without-extracting-it.html
if it's inside a JAR, it's not a File, generally speaking. You should load the data using Class.getResourceAsStream(String), or something similar.