Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error occurred during initialization of VM

I'm getting the following error when running an executable I created on a 64-bit machine using C++ code:

"Error occurred during initialization of VM Unable to load native library: Can't find dependent libraries"

My PATH (shown below) obviously points to jvm.dll since I have that file in both C:\Progra~1\Java\jdk1.6.0_17\jre\bin and C:\Windows\System32

PATH=C:\Program Files (x86)\Gmake\bin;C:\Program Files (x86)\apache-ant-1.7.1\bin;C:\Progra~1\Java\jdk1.6.0_17\bin;C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\Tools;C:\Progra~1\Java\jdk1.6.0_17\jre\bin\server;C:\Progra~1\Java\jdk1.6.0_17\jre\bin;C:\Windows\System32

Does anybody have any ideas as to what would cause this error? Thanks.

like image 499
Brittany Avatar asked Mar 25 '10 15:03

Brittany


2 Answers

Use dependency walker to figure out what dll is missing.

like image 178
Omry Yadan Avatar answered Oct 10 '22 05:10

Omry Yadan


I have the same issue when I run the java.exe in my Windows2008 R2 version.

my path was

PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32
\WindowsPowerShell\v1.0\;C:\Program Files\System Center Operations Manager 2007\
;C:\Java\jdk1.6.0_33\bin

when I run the java.exe under C:\Java\jdk1.6.0_33\bin, it works fine. I found that within the c:\Windows\System32\ comes with a copy of java.exe. When I run the c:\Windows\System32\java.exe, it shows the same error:

C:\>Windows\System32\java.exe
Error occurred during initialization of VM
Unable to load native library: Can't find dependent libraries

I fixed this issue by moving the C:\Java\jdk1.6.0_33\bin to the beginning of the PATH environment:

PATH=C:\Java\jdk1.6.0_33\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\
Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\System Center
Operations Manager 2007\

Hope this help.

like image 22
hzhsun Avatar answered Oct 10 '22 05:10

hzhsun