I am trying to add a Quartz Scheduler to an existing Java class.
The class uses String[]
args as input from the main function.
public static void main(String[] args) {
//validate(args);
summarizeData(args);
}
But then the Java class implements Job
, and it has to use the execute
method which only takes one argument.
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);
}
Any suggestions?
Edit 1: The args should be command-line arguments in String
Problem solved.
I had to map the command-line arguments to
JobDataMap
in the scheduler class. Then usegetJobDataMap()
in the.execute
method to retrieve the arguments and putting them back into aString[]
.