Webapp servers such as Tomcat do not "run programs". They
host webapps.
The difference is this: a program runs as a process (
thread). It has a definite starting point and ending point(s). The Tomcat server itself is therefore a "program". Or in Java terminology, an Application.
Webapps do not run as threads. They are strictly re-active. When an HTTP/HTTPS URL request is received at one of Tomcat's tcp listener ports, Tomcat decodes that request, pulls a thread from its request processor thread pool, and tells the thread to go call a webapp resource (
servlet or
JSP) that has been mapped to handle it. The resource processes the request, generates results, then returns to the Tomcat dispatcher, which puts the now-idle thread back in its process pool. So webapp resources don't run continuously, unlike programs. They're more like DLL calls, to put it in Windows terms.
It's not uncommon for a webapp to run in conjunction with a scheduled process or a long-running process. However, since the HTTP request/response mode of operation isn't suitable for that, the recommended alternative is to spawn an offline process, which can be integrated into a webapp by starting and ending it using a ServletContextListener.
If you don't need web interfacing, there are other alternatives. You can run a completely stand-alone Java application without modification by using an OS-supplied program scheduler (cron, for Linux, Unix, and MacOS or the Windows Scheduler for Windows). If you want a general non-web container to run an application (or multiple applications) based on a schedule, you might want to look at a general process container such as Apache Karaf.
Some people, when well-known sources tell them that fire will burn them, don't put their hands in the fire.
Some people, being skeptical, will put their hands in the fire, get burned, and learn not to put their hands in the fire.
And some people, believing that they know better than well-known sources, will claim it's a lie, put their hands in the fire, and continue to scream it's a lie even as their hands burn down to charred stumps.