Reputation: 935
I have a java package, I want to my program be runned every night at 0 o'clock automaticlly, how can I do this work?
Upvotes: 0
Views: 171
Reputation: 14559
You can either schedule in your own OS. On *nix, there is cron. I'm not sure what is used in windows.
Or you can make your own java program schedule: on running it, it sets a times to execute your task in a specific time.
You could use a Thread.sleep()
counting the time from now until midnight, but that's a poor-man's solution. Quartz is your man, as it works schedulling your tasks.
If you choose the schedulling path, you can't forget to run your application in the OS startup
Upvotes: 1
Reputation: 115388
Generally you have 2 solutions:
Upvotes: 1