Caroline,

You need to use getResourceAsStream() method from
ServletConfig class.

request.getSession().getServletContext().getResourceAsStream("/filename.properties");

This will return you an InputStream that you can pass
to Properties.loadProperties() and make it work.

The "/" represents the context root.


Nitin
--- Caroline Jen <[EMAIL PROTECTED]> wrote:

> The application.properties file in my web
> application
> works OKay.
> 
> I have another file called
> storageDirectory.properties, which has one line:
> 
> outputFile =
> C:\\jakarta-tomcat-5.0.27\\webapps\\AppName\\var\\
> 
> I set my classpath to
>
C:\jakarta-tomcat-5.0.27\webapps\AppName\WEB-INF\src\java
> 
> One of my class in the
>
C:\jakarta-tomcat-5.0.27\webapps\AppName\WEB-INF\src\java\org\OrganizationName\content
> directory tries to read this
> storageDirectory.properties file:
> 
> final String PROPFILE =
> "storageDirectory.properties";
> Properties oProp = null;
>        
> FileInputStream fis = new FileInputStream( PROPFILE
> );
> oProp = new Properties();
> oProp.load ( fis );
> 
> I put this storageDirectory.properties in the 
>
C:\jakarta-tomcat-5.0.27\webapps\AppName\WEB-INF\src\java
> directory.
> 
> I then put this storageDirectory.properties in the 
>
C:\jakarta-tomcat-5.0.27\webapps\AppName\WEB-INF\src\java\resources
> directory.
> 
> No matter where I put this properties file, I get
> this
> runtime error message:
> java.io.FileNotFoundException:
> storageDirectory.properties (The system cannot find
> the file specified)
> 
> And it points to this statement:
> FileInputStream fis = new FileInputStream( PROPFILE
> );
> 
> 
>               
> _______________________________
> Do you Yahoo!?
> Declare Yourself - Register online to vote today!
> http://vote.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 



                
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

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

Reply via email to