定时任务
public static void main(String[] args) {
// Properties pps = new Properties();
// try {
// pps.load(new InputStreamReader(new FileInputStream("config/config.properties"), "UTF-8"));
// } catch (IOException e1) {
// e1.printStackTrace();
// }
// String startTime = pps.getProperty("start_time");
String startTime = "2017-08-04 9:10:10";
// 程序启动周期
// 程序启动时间(第一次)
Date date = null;
try {
date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(startTime);
} catch (ParseException e) {
e.printStackTrace();
}
Timer timer = new Timer();
assert date != null;
timer.schedule(new TimerTask() {
@Override
public void run() {
try {
start();
} catch (Exception e) {
e.printStackTrace();
}
}
}, date, DAY);
}