// Creates the scheduler.
Scheduler scheduler = new Scheduler();
// Registers the listener.
scheduler.addSchedulerListener(listener);
// Schedules the task, once every minute.
scheduler.schedule("* * * * *", task);
// Starts the scheduler.
scheduler.start();
// Stays alive for five minutes.
try {
Thread.sleep(5L * 60L * 1000L);