search

Home  >  Q&A  >  body text

java - Linux 运行有依赖的Jar失败

PHPzPHPz2779 days ago655

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 15:02:48

    Use -Djava.ext.dirs directly to automatically load JAR files, eliminating the need to load them one by one.

    java -Djava.ext.dirs=$RUN_LIB -jar *.jar > $LOG_FILE  &

    reply
    0
  • 阿神

    阿神2017-04-17 15:02:48

    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.

    reply
    0
  • Cancelreply