commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rashid Jilani" <>
Subject RE: [component]commons.configuration.PropertiesConfiguration - load properties from classpath
Date Fri, 09 Jul 2010 20:14:09 GMT
It depends in which context you need to load resource, web or desktop

In desktop application let's say you have the root application in the folder
Foo and there is a folder config under folder Foo where you have your
configuration file name config.xml, you can use something like this

String nativeFileSeperator = System.getProperty("file.separator");
        String currentDirectory = System.getProperty("user.dir");
        String configurationFile = currentDirectory + nativeFileSeperator +
config +  nativeFileSeperator + 'config.xml';

In case of web application you can use the servletcontext. getContextPath()
which will return the application path of the current context, then you can
load the resources in the relative folders under the current context path.


-----Original Message-----
From: apreg [] 
Sent: Friday, July 09, 2010 2:51 PM
Subject: Re: [component]commons.configuration.PropertiesConfiguration - load
properties from classpath

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.
View this message in context:
Sent from the Commons - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message