我正在创建一个简单的Cron Scheduler。我没有IDE工作,所以文件没有编译
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
public class CronJob implements Job{
public void execute(JobExecutionContext arg0) throws JobExecutionException {
// TODO Auto-generated method stub
System.out.println("Regular");
SendRegular sR = new SendRegular();
sR.Reglar();
System.out.println("Reappear");
SendReappear SR = new SendReappear();
SR.Reapp();
}
}
这是我正在编译的代码
java CronSched
这是我运行代码的方式,我收到以下错误
Error: A JNI error has occurred, please check your installation and
try again
Exception in thread "main" java.lang.NoClassDefFoundError:
org/quartz/ScheduleBuilder
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at
sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at
sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.q
uartz.ScheduleBuilder
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
哪里错了?
答案 0 :(得分:0)
javac -cp ".:/home/aditya/CronSched/CronSched/lib/quartz-2.2.3/lib/quartz-2.2.3.jar" CronJob.java
不要编译两个石英文件,IDE会接受它但是化学编译不接受
答案 1 :(得分:0)
以下是在命令行上使用javac -cp的一些示例:
请注意,罐子列表中没有空格,也不需要双引号。