I am using this method:
your.package.YourClass.class.getResourceAsStream("/yourconfig.cfg")
to access my .properties file. I have the location in my classpath, but am
still not able to find the file. Does the file need to be inside Tomcat to be
read, or can I have it anywhere on the file system?
Thanks,
Nate
----- Original Message -----
From: [EMAIL PROTECTED]
To: [email protected]
Sent: Wednesday, March 14, 2007 11:15 AM
Subject: Antwort: Re: Help Read in Properties File
If you want to read in a file in your classpath (without exactly knowing
where to find) you have to do following:
your.package.YourClass.class.getResourceAsStream("/yourconfig.cfg")
Note: The SLASH before configuration file name is important. Without it, java
won't search for this file into your classpath.
It will then only look if this file is in the same folder, where your class
lies:
YourClass.class.getResourceAsStream("yourconfig.cfg")
-->Config had to lie here /your/package/yourconfig.cfg
wbr,
Daniel Kuschow