Am 09.07.2010 21:50, schrieb apreg:

Yeah, you have right. I works, but what if I'd like to put my .properties
files elsewhere not in the root of my source folder. What should I write in
the vm arguments to accomplish this and how should  I reference to the
specified .properties file from code? Sorry if I am on the wrong way.

You have multiple options, but I think the best way is to resolve the properties file on your own:

Use Class.getResource() or ClassLoader.getResource() (have a look at the Javadocs if necessary) to obtain a URL to the properties file. Then pass this URL to PropertiesConfiguration.

For instance, if the properties file lies in the same package as the class from which you want to load it, you can do something like the following:

URL url = getClass().getResource("config.properties");
assert url != null : "Cannot resolve configuration file!";
PropertiesConfiguration config = new PropertiesConfiguration(url);

HTH
Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to