Reputation: 439
I've created a small java program and I want to launch it everyday at 1 o'clock. I can add it windows task plannifier and it works very well but I want to do it with java.
The java timer task seems to be not good.
I heard about Quartz and when I try their it seems to be complicated for me or I don't find the simple example or tutorial.
Can anyone know some good tutorial or example code easier than the Quartz's site. Or redirect me to some other site.
Upvotes: 0
Views: 935
Reputation: 12575
small java program and I want to launch it everyday at 1 o'clock
Scheduling a Job For a Specific Time Every Day
The basic usage of cron
is to execute a job in a specific
time as shown below.This will execute the sample_java_program
everyday at 1am.
30 01 * * * java /home/suresh/sample_java_program
* 30 – 30th Minute
* 01 – 01 AM
* * – every Day
* * – every Month
* * – Every day of the week
Upvotes: 1
Reputation: 439
When you say:
Both Quartz and the built in Timer class are not built to start your whole application.
So i could never launch my whole java program with Quartz or Timer. it only launches some speicfic task while my prg is running?
so it's better to keep Windows task Scheduler? ok thank you
Upvotes: 0
Reputation: 240860
Quartz is a full-featured, open source job scheduling service that can be integrated with, or used along side virtually any Java EE or Java SE application.
The basic terminology are (at very basic view):
Scheduler : You can think of this as the core container or something that is the base of quartz.
Job : You can think this as the task we need to do , out simple java Class
Trigger : Something that will make Job to run on scheduler, there are two types of trigger with quartz
Upvotes: 2
Reputation: 308001
Both Quartz and the built in Timer
class are not built to start your whole application. They are built to run some specified tasks according to some schedule as long as your application is running.
To actually start your application at a specified time, an external resource will be necessary (unless you want your application to run at all times and only do some activity ever so often).
For that purpose the Windows Task Scheduler is sufficient.
Upvotes: 3