File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes schedule a task Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "schedule a task " Watch "schedule a task " New topic
Author

schedule a task

Sherif Shehab
Ranch Hand

Joined: Mar 05, 2007
Posts: 483

Hi pals ,

i need to run a specific class in 12 am everyday, except predefined 2 days in the week , i found the TimerTask class but i saw it will not provide me to stop in the 2 days i want , so any recommendation to accomplish this ?


Thanks,
Sherif
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

You can use your os's scheduling system, quartz or build something yourself using something like Timer.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19684
    
  20

Use the operating system. Linux has cron, Windows has its own Scheduled Tasks / Task Scheduler. Both give you a lot of freedom, and you don't need to have your application running in the background all the time. With Windows you'll need to go to the more advanced settings, but even these are not really advanced.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Sherif Shehab
Ranch Hand

Joined: Mar 05, 2007
Posts: 483

unfortunately i'm using windows , So what do you think the professional way to accomplish this, is by using Quartz or windows schedule task ?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19684
    
  20

I don't see one as being more professional than the other. I'd use the Windows Task Scheduler, but that's because it's easier to configure. And of course you should document that there is a scheduled task and what it's for
 
jQuery in Action, 2nd edition
 
subject: schedule a task