tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Milt Epstein <>
Subject Re: Storing property file
Date Mon, 02 Apr 2001 18:33:16 GMT
On Mon, 2 Apr 2001, Scott Walter wrote:

> Hi,
> I want to get your guys/girls input on the following:
> I am building an app that will run under Tomcat and in
> the future J2EE app servers.  Currently I am storing
> parameters for connecting to a database (i.e. jdbc
> url, driver, etc.) inside a .properties file.  
> When the app is started for the first time I want the
> user to enter values for db parameters and then to
> write them to the property file.
> Currently I am reading the properties file off the
> classpath via getResource().  Is there anyway that I
> can figure where exactly on the file system where the
> properties file is located at so I can write to it in
> the correct location???
> I took a look at the Jive open source project and they
> have the user put the location where the file exists
> on the file system as an entry in the properties file,
> I would like a more elegant solution.

FWIW, resources found via getResource() can be written to, when
appropriate.  I have an article written by Jason Hunter (author of
O'Reilly's Servlets book) from JavaWorld Dec. 1998 that covers the
changes from servlet spec 2.0 to 2.1 (I don't have the exact URL, but
you should be able to find it from that info), and it talks about this
there (page 7, near the bottom, "Writing to an abstract resource").
Take a look at that for details.

Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)

View raw message