How to run a Java program under cron and import the jars
问题 My source file is .../MyDir/proj/myProj.java . The jar files are under .../MyDir/proj/library . The jar files are from HTMLUnit 2.10. This is the source for my cron file: 0 0 * * * java -classpath .../MyDir/proj/ myProj But it gave me the error: Exception in thread "main" java.lang.NoClassDefFoundError: com/gargoylesoftware/htmlunit/WebClient How do I modify the cron file to import the jar files? 回答1: Something like this: 0 0 * * * java -classpath .../MyDir/proj/:.../MyDir/proj/library/jar1