Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting "Error occurred during initialization of VM"

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
fi

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.

like image 1000
NJMR Avatar asked Jun 03 '18 06:06

NJMR


People also ask

How do you resolve Error occurred during initialization of VM Could not reserve enough space for object heap?

To fix the error "Could not reserve enough space for object heap", add the options "-Xmx<size>m" to set the maximum size for the object heap memory allocation. This must be set large enough to accommodate loading your application into memory, but smaller than your requested total memory allocation by 2GB.

Could not reserve enough space for 2097152kb object heap Error occurred during initialization of VM?

You might get an specific error Could not reserve enough space for 2097152kb object heap in case you are using any tool. It simply means that JVM is not able to acquire 2 GB heap space which is required by the tool by default.


1 Answers

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...

like image 171
NJMR Avatar answered Nov 15 '22 23:11

NJMR