Search code examples
javaconfigurationini

Java Config File not specific to directory


I am using a configuration (.ini) file with my java app. At the moment I am specifically calling the location of the dll like this.

Properties p = new Properties();
p.load(new FileInputStream("C:\\myconfigfile.ini");

I would like to have it so the user does not have to put it into a certain directory before the program operates.

Is there a way to implement this or is this just the best practice to go with.


Solution

  • You should put your ini in a resources folder and load them as resources. Here's an excellent tutorial to get you started.