JNI_CreateJavaVM always returns -1
March 20th, 2009
Applies to:
JNI
Description:
Occurs while using JNI.
Cause:
Usually, the problem is that you moved or copied the jvm.dll file. The location of jvm.dll is important, it has to be in the directory
The problem manifests itself for those using the invocation API who want to keep their PATH simple, containing only\bin. You need \bin\classic; \bin in your PATH. This does not work:
# Do not do this!
cd jre\bin
copy classic\jvm.dll .
Note that on Windows you can use also use the registry key:
HKEY_LOCAL_MACHINE\Software\JavaSoft\JRE\RuntimeLib
to find the path to jvm.dll and load it with LoadLibrary.