Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Meir Yan
Ranch Hand
Posts: 599
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Meir Yan:

to the prompt


the "prompt"? What's that?
 
Theodore Casser
Ranch Hand
Posts: 1902
Hibernate Netbeans IDE PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Scott Johnson
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 599
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic