获取 "Error occurred during initialization of VM"

Getting "Error occurred during initialization of VM"

我有一个遗留的 shell 脚本被 Autosys 作业调度程序调用。在脚本中,他们调用了一个 jar 文件

res="`$JAVA_HOME/bin/java ....`"
echo >$res<

我收到以下错误。

Error occurred during initialization of VM 
    java.lang.Error: Properties init: Could not determine current working directory.

所以在 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

所有 class 路径都在脚本本身中设置,class 路径看起来不错。我不知道这里可能是什么问题。

另请注意,此脚本正在被 Autosys 作业调度程序调用的另一个脚本调用。

这是预期的行为。

脚本 运行 在子 shell 中,无法更改父 shell 工作目录。它的效果在完成时会丢失。

SO Reference for a workaround.

感谢安德鲁的提示。

正如 post 中所说,它是一个遗留脚本,每个脚本中都有数千行,这让我们的分析变得困难。但最终发现我们出错的过程是由另一个用户启动的。该用户没有访问父文件夹的权限,因此我们得到

Could not determine current working directory.

我已将父文件夹的权限授予该用户,并且成功了。 感谢大家...