更新时间:2022-01-09 02:40:59
在您的Shell脚本中,切换到包含jar文件的目录.可能不是***做法,但我一直使用它来模仿脚本从其开始的工作目录".这样,我的shell脚本可以安装在scripts
目录中,而Java可以安装在lib
目录中.
In your shell script change into the directory containing the jar files. Possibly not the best practice but I use this all the time to emulate a 'working directory' where scripts are started from. This way my shell script can be installed in a scripts
directory and my Java can be installed in a lib
directory.
假定执行脚本时的环境与从命令行调用Java时的环境相同.
Assuming your environment is the same when you execute the script as when you call the java from the command line.
#!/bin/sh
cd /home/applvis/Java/UAT/lib
java -jar DirectoryScanner.jar