Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

tomcat question

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do you run a program when tomcat starts up? When tomcat starts up I need to start up a program which does some initializing, and starts a thread when tomcat starts. I would also like to shut this program down when tomcat shutdowns.
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are on a dos machine, create two .bat files, one for starting and one for stopping.
 
Chris Huisman
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So within tomcat how do I get those two .bat to run on startup?
 
Randall Twede
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use a .bat program(tom.bat) to start tomcat. I put it in the Windows folder. When I go to MS-DOS Prompt from the start menu, it opens a dos window with the directory set to C:\Windows.
I just type in tom. Here is my .bat program:

You would want to also include code to start your other program.
Im not as sure about stopping.
I stop tomcat from the dos window that is already open.
Sorry I know just enough DOS to get by.
Hope that helps
[This message has been edited by Randall Twede (edited February 12, 2001).]
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Edit the startup.bat file under jakarta-tomcat-1.3.2\bin directory call your bat file at the :start function
For example change your startup.bat by adding the second line as below
:start
call "%TOMCAT_HOME%\bin\tomcat" start %1 %2 %3 %4 %5 %6 %7 %8 %9
call "c:\yourbatfile.bat"
Hope this helps
Ajan

[This message has been edited by Ajan Balakrishnan (edited February 12, 2001).]
 
eat bricks! HA! And here's another one! And a tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic