• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

schedule a java program to run everyday at 6'0 clock

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have to develop a java program which will run everyday at 6pm everyday. This program does some updation of the database. how to do this. Operating system is windows. it is a desktop application. Thanks.
 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
not sure why you would want to use threads for this
if you want to run the code at a certain time use the windows scheduler

http://www.iopus.com/guides/winscheduler.htm

use google to find more details

Dave
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use java.util.TimerTask
 
amit kumar goyal
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks everybody for the replies. I have done it using TimeTask.
 
Saloon Keeper
Posts: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just to enumerate the common possibilities:

1. Use Unix/Linux cron and run the program under a batch script. Windows also has this ability, although the scheduler mechanism is different.

2. Set up a timer task thread (which you did).

3. Incorporate Quartz Scheduler and let it do cron-like functions. You'd normally only do this in the case where a long-running application (stand-alone or webapp) is present to house the quartz manager threads and the scheduling requirements are fairly complex.

Incidentally, one of the best ways to "hang" shutdown of a web application server is to run a scheduler inside a webapp. Until ALL threads - including the scheduler threads - are terminated, the appserver will probably not shut down. In the specific case of Tomcat, the appserver will definitely not shut down. You can remedy this by terminating the scheduler in a servlet's destroy() method,
 
It's exactly the same and completely different as this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic