package qt;
import java.util.Date;
import static org.quartz.JobBuilder.*;
import static org.quartz.TriggerBuilder.*;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SimpleTrigger;
import org.quartz.impl.StdSchedulerFactory;
public class SimpleTriggerExample {
public static void main( String[] args ) throws Exception
{
JobDetail job = new JobDetail(); //**error: cannot instantiate the type of job detail
job.setName("dummyJobName"); //**error: mehod setname is undefined for jobDetail
job.setJobClass(HelloJob.class);
//configure the scheduler time
SimpleTrigger trigger = new SimpleTrigger(); /error: cannot instantiate the type of simple trigger
trigger.setStartTime(new Date(System.currentTimeMillis() + 1000));
trigger.setRepeatCount(SimpleTrigger.REPEAT_INDEFINITELY);
trigger.setRepeatInterval(30000);
//schedule it
Scheduler scheduler = new StdSchedulerFactory().getScheduler();
scheduler.start();
scheduler.scheduleJob(job, trigger);
}
}
I have included the necessary jar files...but still I'm getting this error,,can anyone please tell me what is wrong with this program.. and while adding jar I didn find "quartz-all-xxxx" I tried searching in many sites..please tell me.... I'm totally stuck with this.
JobDetail
is an interface, you can't instantiate it.
Same with SimpleTrigger
.
You should probably read up about Interfaces in Java .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.