Error occurred during initialization of VM

2019-02-16 08:53发布

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.

5条回答
对你真心纯属浪费
2楼-- · 2019-02-16 09:29

In my case, there was a jvm.dll file in the same folder as my exe file. I simply deleted the jvm.dll from there and it worked. Probably, it preceded the one in the PATH

查看更多
你好瞎i
3楼-- · 2019-02-16 09:33

This is how I solved a similar problem:

查看更多
迷人小祖宗
4楼-- · 2019-02-16 09:35

I got this error as my PATH (environment variable) has not set correctly.

  1. while setting PATH variable, set path of jvm.dll as a very first path in the list
  2. Reboot your machine.

Note: Do not move jvm.dll to your project directory.

查看更多
做自己的国王
5楼-- · 2019-02-16 09:51

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.

查看更多
smile是对你的礼貌
6楼-- · 2019-02-16 09:53

Use dependency walker to figure out what dll is missing.

查看更多
登录 后发表回答