tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank W. Zammetti" <fzli...@omnytex.com>
Subject Re: execute class on start up
Date Mon, 22 Aug 2005 11:34:10 GMT
You can do it a couple of ways...

(1) You could create a startup servlet and load it on startup to call 
your class.

(2) You could use a ContextListener to do the same thing.

Both of those require a webapp of course, and it's not obvious that you 
actually want there to be one.  So, you could also:

(3) Use a static initializer block in the class.  This may not be 
feasible depending on what you need to happen at startup, but it would 
"execute" the class every time Tomcat starts up, as long as its in the 
classpath, whether its part of a webapp or not.

Frank

Xavier López wrote:
> Hello,
> 
> I have a little problem, and perhaps you can help me!
> 
> I made a new java class and I just want to execute it every time 
> that the server Tomcat starts.
> 
> Does anyone know how to do it ?
> I think thats a configuration problem, but I don't know how to solve it.
> 
> Thanks in advance!
> Xavier
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 
> 
> 

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message