In my testing as long as you package the properties file in the root of the jar it should work.  I am not positive on this since I have not fully tested it yet.
 
 
An example of getting a resource is done in the WROX connection pooling code.
 
 
Download Chapter 9.
 
Ryan
-----Original Message-----
From: Ranko Bijelonic [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 02, 2000 10:29 AM
To: [EMAIL PROTECTED]
Subject: RE: Problems finding properties files

Ok, a question related to using resources in jar and war files. 
Given the hierarchy below, if I had a class in etc.jar that used a proprety file also in etc.jar, how would I refer to that property file from that class?  Thanks
 
ranko
 
-----Original Message-----
From: Ryan Littrell [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 02, 2000 1:02 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: Problems finding properties files

Your directory should be like the following:
 
webapps
    isover
        WEB-INF
            web.xml
        classes
            servlet.class
            file.properties
        lib
            jdbcdrivers.jar
            etc.jar
 
 
You could put your properties file in the "webapps/isover/WEB-INF/classes" directory and use getClass().getResourceAsStream("file.properties") then use propertes.load.
 
Hope this helps.
 
Ryan
-----Original Message-----
From: Ivan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 01, 2000 9:41 AM
To: [EMAIL PROTECTED]
Subject: RV: Problems finding properties files

 
----- Original Message -----
From: Ivan
Sent: Wednesday, November 01, 2000 6:31 PM
Subject: Problems finding properties files

Hello,
 
I'm a tomcat user, and I was trying to develop a web application, I included the following lines in server.xml file
 
<Context path="/isover" docBase="webapps/isover" debug="0" reloadable="true">
 </Context>
 
and then I created the isover directory with the appropiate structure and files, I included the properties files in WEB-APP directory, and when I run the application an error appears that says it can't find the property file; this file is used in a servlet.
 
The web.xml file included in my application is the default one that is in the conf directory.
 
I tried to solve the problem including the property file in all of the application directories and the same error appeared again.
 
What could be the problem?
 
My linux version is Red Hat 7.0 with glibc5.0.
 
      Thanks in advance,
 
      Ivan Gutierrez Garcia.

Reply via email to