public class demoRunner extends CommandLineJobRunner {
public static void main(String[] args) throws Exception {
// initialize fileappender here
String logFile = args[args.length - 1].split("=")[1];
DemoAppender.initializeAppender(logFile);
CommandLineJobRunner.main(args);
}
}
作为虚拟机参数运行:META-INF/spring/student.xml student
学生是工作
目录目录:demoBatchJobsrcmainjavacomncssmarunnerdemoRunner.java
student .xml目录:demoBatchJobsrcmainresourcesMETA-INFspringstudent.xml
例外:
错误:无法找到或加载主类META-INF.spring.student.xml产生原因:java.lang.ClassNotFoundException: META-INF.spring.student.xml
尝试将其放在META-INF
之外并添加以下VM参数-
spring/student.xml
运行为虚拟机参数:META-INF/spring/student.xml student
您需要选择demoRunner
作为运行的主类,并将输入文件和作业名称META-INF/spring/student.xml student
作为"程序参数"传递;和而不是作为"虚拟机参数"。