The way we have done is to load a servlet during startup (very easy to do in web.xml) and through this servlet use Class.forName("classname") to load the required classes into memory.
The reason we do this is to read a .properties file and store all the name value pairs in a hashmap to be retrieved by various classes at run time. Hope that helps, Anoop On 12/10/05, Richard Mixon <[EMAIL PROTECTED]> wrote: > > Vineesh, > > You should probably use a ServletContextListener . It will give you > control > when the web application starts and when it ends, among otherevents. It is > pretty well described in the servlet spec and is pretty simple. > > HTH -Richard > > -----Original Message----- > From: vineesh kumar [mailto:[EMAIL PROTECTED] > Sent: Saturday, December 10, 2005 12:22 AM > To: users@tomcat.apache.org > Subject: How to load a class when tomcat starts > > Hi all, > > I need to load a java class when tomcat starts, which will initializes > some > configuration files and so i can use the fields in the class throught the > environment.How can i do this.? > Actually I am working on a distributed application, so the configuration > files may change frequently but once the system is initialized it will not > change until shut down. > regards > vineesh > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Thanks and best regards, Anoop