Hi,
you can put your .properties in your jar (com.here)
and access it by :
InputStream is =
MyClass.class.getClassLoader().getResourceAsStream("com/here/DB.properties");
or use the $TOMCAT_HOME by a System.getPropertie() call.
Mark wrote:
>
> I am trying to load a properties file from a
> class that is in a jar file that is in the $TOMCAT_HOME/lib directory.
>
> The properties file itself is not in the jar. It is
> in $TOMCAT_HOME/properties, which is
> in tomcat's classpath because I added it in
> the startup script (I verified that it is listed
> in the path at startup).
>
> If I use FileInputStream it works, but only
> if I use the full file path. I obviously would
> not like to have to do this.
>
> But if I do the following:
>
> Properties props = new Properties();
> try
> {
> InputStream is = this.getClass().getResourceAsStream("DB.properties");
> if (is == null)
> throw new Exception("Properties file not found");
> props.load(is);
> }
>
> ....
>
> It doesn't work (the exception gets thrown).
>
> Any suggestions on a way to do this that works?
>
> Thanks,
>
> Mark
begin:vcard
n:avrilla;pascal
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
email;internet:[EMAIL PROTECTED]
x-mozilla-cpt:;0
fn:pascal avrilla
end:vcard