I've been able to use configuration files with jars for another application
that I have done.  I have not tried many different things, but I've found
that if I put the config file in the root directory of the jar and then
create a File object with the name of the config file, then everything seems
to work OK.

my jar structure was

config.properties
com/mycompany/app/Class1
com/mycompany/app/Class2

The code in say, Class1 that read the properties file is

File f = new File("config.properties");
java.util.Properties prop = new java.util.Properties();
prop.load(new FileInputStream(f));

Hope this helps,

Joel

> -----Original Message-----
> From: Geoff Fortytwo [mailto:[EMAIL PROTECTED]]
> Sent: Friday, February 01, 2002 11:19 AM
> To: Turbine Users List
> Subject: TurbineConfig constructor that doesn't use path
> 
> 
> The TurbineConfig class requires a path to the 
> TurbineResources.properties. 
> This means that it's impossible to store the 
> TurbineResources.properties 
> file inside a jar file. It also means that I'm forced to use 
> the same path 
> on different machines or specify the path in some external way.
> 
> It would be better if TurbineConfig had an additional 
> constructor which 
> allows the user to specify a class location. TurbineConfig 
> would then use 
> the java.util.ResourceBundle.getBundle function to load the 
> properties file.
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to