I tried:

final String PROPFILE = "storageDirectory.properties";
Properties oProp = null;
       
oProp = new Properties();
oProp.load(
getClass().getClassLoader().getResourceAsStream(
PROPFILE ) );

Now, I got:
java.lang.NullPointerException
        java.io.Reader.<init>(Reader.java:61)

java.io.InputStreamReader.<init>(InputStreamReader.java:80)
        java.util.Properties.load(Properties.java:266)

org.dhsinfo.content.AddFiles.execute(AddFiles.java:40)

The error message point to this statement:
oProp.load(
getClass().getClassLoader().getResourceAsStream(
PROPFILE ) );

The storageDirectory.properties file is in the
C:\jakarta-tomcat-5.0.27\webapps\AppName\WEB-INF\src\java\resources
directory.  

The classpath is
C:\jakarta-tomcat-5.0.27\webapps\AppName\WEB-INF\src\java
--- [EMAIL PROTECTED] wrote:

> Hi, Caroline.
> 
> Your code tries to open a file from the filesystem,
> and since the path you specified is invalid from the
> current working directory you get a
> FileNotFoundException.
> 
> Try a
> oProp 
> new Properties().load
>
(getClass().getClassloader().getResourceAsStream(PROPFILE));
> 
> Hiran
> 
> -----------------------------------------
> Hiran Chaudhuri
> SAG Systemhaus GmbH
> Elsenheimer Straße 11
> 80867 München
> Phone +49-89-54 74 21 34
> Fax   +49-89-54 74 21 99
> 
> 
>  
> 
> > -----Original Message-----
> > From: Caroline Jen [mailto:[EMAIL PROTECTED] 
> > Sent: Dienstag, 19. Oktober 2004 16:45
> > To: [EMAIL PROTECTED]
> > Subject: Problem in Locating a properties File
> (Not 
> > application.properties)
> > 
> > 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]
> > 
> > 
> 
>
---------------------------------------------------------------------
> 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