users@glassfish.java.net

Re: Where to place the properties file?

From: <glassfish_at_javadesktop.org>
Date: Mon, 22 Oct 2007 19:44:45 PDT

Please use ServletContext methods to get a resource as a stream. This is one of the
differences between a Java SE and a Java EE environment. Thus, after placing the properties
files in your web-application, find its path with respect to the root ("/") and then send it as
an argument to getResourceAsStream().

See: http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContext.html#getResourceAsStream(java.lang.String)

The problem with Object.getClass()... is that of "current working directory" of the server
and might have unpredictable and non-standard behavior.

Regards,
Kedar
[Message sent by forum member 'km' (km)]

http://forums.java.net/jive/thread.jspa?messageID=241600