Possible Duplicate:
How do I access a config file inside the jar?
First of all I give you a sample of my code, then I ask what I intend to do :
public static void resetGlobalConfigFile() throws IOException{
File f=new File("appconfig.conf");
FileWriter fWritter = new FileWriter(f);
BufferedWriter bWritter = new BufferedWriter(fWritter);
bWritter.write("# Path to the campaigns config file (xml)\r\n");
bWritter.write("campaigns_xml_file=./campaigns/campaigns.xml");
bWritter.close();
f.createNewFile();
}
In fact when I distribut my jar, there is a config file with it (appconfig.conf).
In my code I have done the resetGlobalConfigFile() method for allow the user to reset this config file with the default values.
But I think It would be better to store a default config file (for example embedded in my .jar;is it possible ?) that I can easyly manage with my favorite text editor (while developpement stage). When application is compiled nobody could edit the default config file.
But I dont know how to do it ? Maybe you have any other solution ? Because the real goal is to can write this default file with a text editor (in developemment stage) and nobody can change the default values when compiled (production stage) !
Thaks for reading.