-4

Can anyone please help me in scheduling to run a eclipse java program daily at 8 PM?

I used various methods such as codepro, quartz but i don't know how it works?

  • A quartz is a easy/simple scheduler...why wouldn't it work – surya Feb 22 '16 at 02:47
  • 1
    http://stackoverflow.com/questions/7855666/cron-job-for-a-java-program theres already solution here better check stackoverflow before you post . – SmashCode Feb 22 '16 at 02:50

1 Answers1

0

You can try this:

Timer timer = new Timer();
timer.schedule(new TimerTask() {
    public void run() {
        // what to do every 8:00am
    }
}, new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse("2016-2-23 8:00:00"), 24*60*60*1000);

Explain:

Start time: new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse("2016-2-23 8:00:00");

Period after first start: 24*60*60*1000 = one day in milliseconds.

Bahramdun Adil
  • 5,907
  • 7
  • 35
  • 68