File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes is there any way to run java class without client invocation in tomcat? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "is there any way to run java class without client invocation in tomcat?" Watch "is there any way to run java class without client invocation in tomcat?" New topic
Author

is there any way to run java class without client invocation in tomcat?

Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
Hello all
i wander if there is possibility to invoke java class from tomcat server say for instance
when tomcat is done loading he will invoke some kind of class that prints "hello ..."
to the prompt , whiteout invoking it from the client side (like jsp page calling java class ).
thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

Originally posted by Meir Yan:

to the prompt


the "prompt"? What's that?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Theodore Casser
Ranch Hand

Joined: Mar 14, 2001
Posts: 1902

I suppose (but have never tried it) you could set up a servlet to load at server startup and have that servlet spawn a process on the server machine that would pop up a window on the console to print the message or somesuch... but I'm not quite sure why you'd want to do that in the first place, really.

Is that what you're inquiring about?


Theodore Jonathan Casser
SCJP/SCSNI/SCBCD/SCWCD/SCDJWS/SCMAD/SCEA/MCTS/MCPD... and so many more letters than you can shake a stick at!
Scott Johnson
Ranch Hand

Joined: Aug 24, 2005
Posts: 518
Create a class that implements ServletContextListener and configure it in the deployment descriptor.

When you say prompt do you mean the app server log?
Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
hello and thanks for the fast reply
yeah i mean to the server log or othere log ,
i like to invoke thread deamon when the server starting
so you say servelet?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

ContextListeners are probably what you're looking for:
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletContextListener.html


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: is there any way to run java class without client invocation in tomcat?
 
Similar Threads
Java and DLL's
invoke servlets from apache/htdocs/servlet
Web Client and Swing Client distinction - Preferred pattern
How to call ENtity Bean from Message driven bean
instruction - writing Data Client. "WAITING FOR RESPONSE"