Search code examples
javaquartz-scheduler

Unable to execute Quartz Simple Trigger Tutorial


Hi i have tried for two days to run this code example from Quartz Scheduler simple trigger. This example show a code to run a schedule job for every two days but my compiler return error

Tutorial site http://quartz-scheduler.org/documentation/quartz-2.2.x/cookbook/BiDailyTrigger

Trigger trigger = TriggerBuilder //error: non-static method withIdentity(String,String) cannot be referenced from a static
    .withIdentity("trigger3", "group1")
            .startAt(tomorrowAt(15, 0, 0)
            .withSchedule(simpleSchedule()   //error:cannot find  symbol:   method withSchedule(SimpleScheduleBuilder)
            .withIntervalInHours(2 * 24) // interval is actually set at 48    hours' worth of milliseconds
            .repeatForever())
            .build());

is there any of good folk here can help me point out what is my mistake. Really appreciate your help.


Solution

  • The sample you linked to uses newTrigger() but you are using TriggerBuilder. newTrigger() is a static method on TriggerBuilder - use it.