This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes timer for a task Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "timer for a task" Watch "timer for a task" New topic

timer for a task

mark smith
Ranch Hand

Joined: Apr 05, 2005
Posts: 245

i have program who run 24h/24h...

i would like to start a task (method) at 5:00 and stop this task at 18:00...
is there a way to do it?

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 36465
Lots of ways; doing a search of these fora will reveal other threads about the same subject.
Try a java.util.Timer or a javax.swing.Timer, or repeatedly querying Calender objects for the time, or anacron or cron, or Windows task scheduler. As I said, a search will reveal many possible solutions.
I agree. Here's the link:
subject: timer for a task
Similar Threads
Democrats might have just cost themselves the election
back ground process id ??
SEVERE: BAD packet signature 200,SEVERE: Caught exception (java.lang.NullPointerException)
java.util.Calendar, setTime and DST