【发布时间】:2016-01-19 21:53:49
【问题描述】:
我正在尝试将 Quartz Scheduler 添加到现有的 Java 类中。
该类使用String[] args 作为主函数的输入。
public static void main(String[] args) {
//validate(args);
summarizeData(args);
}
但是Java类实现了Job,它必须使用execute方法,它只接受一个参数。
public void execute(JobExecutionContext arg0) throws JobExecutionException {
// How to get the String[] args and pass it to this execute method?
// Then I can pass it to the next helper functions, etc.
// summarizeData(args);
}
有什么建议吗?
编辑 1:args 应该是 String 中的命令行参数
【问题讨论】:
-
您可能想在您的问题中添加您传递给
main的内容(例如,args是什么以及为什么在执行时需要它) -
@Avantol13 参数是字符串中的两个日期(start_date,end_date)。我在执行时需要它,因为其他帮助函数,例如 summariseData() 使用它作为输入。
标签: java command-line-arguments quartz-scheduler