I\'m writing a scheduling application in Java using Quartz. I\'m using the CronTrigger, but my cron expressions are entered into a database before they are scheduled and are
If you are using org.quartz, you can validate a Cron expression as follows:
try {
CronExpression cron = new CronExpression(cronExpression);
...
} catch (ParseException e) {
//exception handling
}
Quoted from official API document Class CronExpression:
public CronExpression(String cronExpression) throws ParseException
Constructs a new CronExpression based on the specified parameter.
Parameters:
cronExpression - String representation of the cron expression the new object should represent
Throws:
ParseException - if the string expression cannot be parsed into a valid CronExpression