views:

49

answers:

2

I want to run my java program in regular interval , lets say, in every 3 hours. I am thinking to write a .bat file and put command to call java class. But what is the best way to run .bat regularly in windows xp. Thanks in advance. I dont want to use third party tool.

+3  A: 

Windows scheduled tasks are built for exactly that purpose.

You can run things on multiple schedules (so you can get your every-three-hour behaviour) and you can get your code to run whether or not logged in.

The multiple scheduling is a bit tricky. You basically set ip up as a daily task to start with but, near the end, it will ask you if you want to do advanced features.

Select yes then you can set up multiple schedules at that point.

paxdiablo
They have their limitations though. I prefer to have a *real* scheduler like [Zena](http://www.asg.com/products/product_details.asp?code=ZNC)
C. Ross
+1  A: 

If you want a pure Java Based solution you can try QUARTZ SCHEDULER. But as paxdiablo already mentioned, Windows Task Scheduler will do that as well.

Pablo Santa Cruz