java - Getting “Error occurred during initialization of VM”

linux error occurred during initialization of vm java/lang/noclassdeffounderror java/lang/object (2)

It is an expected behavior.

The script is run in a subshell, and cannot change the parent shell working directory. Its effects are lost when it finishes.

SO Reference for a workaround.

I have a legacy shell script that is being called by the Autosys job scheduler. In the script they are calling a jar file

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

and I am getting the following error.

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

So in the shell script I tried to print the current directory as shown below

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

All the class paths are being set in the script itself and the class path looks fine. I am not getting what might be the issue here.

Also note that this script is being called by another script which intern called by Autosys job scheduler.

Thanks to Andrew for the hint.

As said in the post it was a legacy script, and had thousands of line in each of the script which made our analysis hard. But finally figured out that the process in which we were getting error was being launched by another user. That user didn't had permission to access the parent folder and hence we were getting

Could not determine current working directory.

I gave the permission on the parent folder to that user and it worked. Thanks to all of you...