You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Grant Ingersoll <GS...@syr.edu> on 2004/11/11 15:21:50 UTC

[configuration] Properties files in jars

Hi,

I am using the commons-configuration-1.0.  I would like to specify a
property file located in a JAR file.  The following property declaration
_does_  work:

<properties
fileName="jar:file:///c:/myPath/myJar.jar!/my.properties"/>

However, I would like to specify a relative path to the JAR file
instead of a full path (as other developers on the project may not have
the file in the same path).  I have tried a variety of combinations, but
none seem to work.  

Can anyone shed some light on this?  Is it possible to specify a
relative path for JAR files like this?  The JAR file is in the
classpath, if that matters.

Thanks,
Grant Ingersoll

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [configuration] Properties files in jars

Posted by Oliver Heger <he...@med.uni-marburg.de>.
ConfigurationFactory can load property files from classpath. Did you try

   <properties fileName="/my.properties"/>  ?

A couple of steps are performed to resolve the file: It is checked 
whether a full URL or an absolute or relative file name are provided. If 
this fails, the classpath is searched for the specified file.

HTH
Oliver

Grant Ingersoll wrote:

> Hi,
> 
> I am using the commons-configuration-1.0.  I would like to specify a
> property file located in a JAR file.  The following property declaration
> _does_  work:
> 
> <properties
> fileName="jar:file:///c:/myPath/myJar.jar!/my.properties"/>
> 
> However, I would like to specify a relative path to the JAR file
> instead of a full path (as other developers on the project may not have
> the file in the same path).  I have tried a variety of combinations, but
> none seem to work.  
> 
> Can anyone shed some light on this?  Is it possible to specify a
> relative path for JAR files like this?  The JAR file is in the
> classpath, if that matters.
> 
> Thanks,
> Grant Ingersoll
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 


-- 
Dipl.-Inform. Oliver Heger
Zentrale Informationsverarbeitung (ZIV) / Bereich Anwenderverfahren
Klinikum der Philipps-Universität Marburg
Baldingerstraße,
D-35037 Marburg
Tel: +49 6421 28-66923
mailto:oliver.heger@med.uni-marburg.de

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org