NJM*_*JMR 17 java unix linux shell solaris
我有一个由Autosys作业调度程序调用的旧shell脚本.在脚本中,他们调用一个jar文件
res="`$JAVA_HOME/bin/java ....`"
echo >$res<
Run Code Online (Sandbox Code Playgroud)
我收到以下错误.
Error occurred during initialization of VM
java.lang.Error: Properties init: Could not determine current working directory.
Run Code Online (Sandbox Code Playgroud)
所以在shell脚本中我尝试打印当前目录,如下所示
echo "PWD:" "$PWD" # Nothing gets printed.
echo "USER:" "$USER" # User id is getting printed
if [ -d "/export/home/abc/" ]; then
echo "Directory present" # gets printed
echo `ls -ltr` # total 3 gets printed
echo `cd /export/abc/def`
echo `pwd` # nothing gets printed
fi
Run Code Online (Sandbox Code Playgroud)
所有类路径都在脚本本身中设置,类路径看起来很好.我没有得到这里可能存在的问题.
另请注意,此脚本由另一个脚本调用,该脚本由Autosys作业调度程序调用.
感谢安德鲁的提示。
正如帖子中所说,它是一个遗留脚本,每个脚本中有数千行,这使我们的分析变得困难。但最终发现我们遇到错误的过程是由另一个用户启动的。该用户无权访问父文件夹,因此我们得到
Could not determine current working directory.
Run Code Online (Sandbox Code Playgroud)
我向该用户授予了父文件夹的权限并且它起作用了。感谢大家...