Howdy,

>An alternative is for the webapp to read the file from "somewhere on
the
>classpath".  I have not tried it and don't know the exact technique,
but
>you should be able to find how to do it.  Then you could put your file
in
>web-inf/classes in your .war file.

The technique is simple: place file, e.g. x.prop, in top-level of a jar
file on the classpath.  Then in any class do
URL xProp = getClass().getResource("/x.prop");
Or InputStream xPropInput = getClass().getResourceAsStream("/x.prop");

Alternatively, you can place the file at the same level as the class
that's going to use it and call
URL xProp = getClass().getResource(getClass().getPackage().getName() +
".x.prop") or the InputStream equivalent.  Note no leading slash here.
More documentation is at the ClassLoader#getResource javadoc.  This is a
good technique for anyone to know.

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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

Reply via email to