First: *.jar should be avoided writing this way. If one day a teammate throws a jar package into it for you, problems may occur.
Second: In your shell script:
LIB_CLASS = '.'
This . should refer to the crontab working directory (PWD), which is the user’s default directory, so if you have a class file under /home/user/crontab-job/projectX, your classpath It should not be included.
Use
-Djava.ext.dirs
directly to automatically loadJAR
files, eliminating the need to load them one by one.First: *.jar should be avoided writing this way. If one day a teammate throws a jar package into it for you, problems may occur.
Second: In your shell script:
This
.
should refer to the crontab working directory (PWD), which is the user’s default directory, so if you have a class file under /home/user/crontab-job/projectX
, your classpath It should not be included.