Search code examples
javac++macosjvmjava-native-interface

Failed to locate method JNI_GetCreatedJavaVMs in the libjvm.dylib (Mac OS)


I am trying to embed java virtual machine in my program but I libjvm.dylib lacks JNI_GetCreatedJavaVMs.

The program works fine both on Windows and on Linux platforms. However, when running on Mac OS I'm getting:

Failed to locate method JNI_GetCreatedJavaVMs in the shared library libjvm.dylib

exception.

I use libjvm.dylib located in /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries directory.

I think the issue is in using the wrong libjvm however, I was unable to find it in other directories.

I'd be happy to be pointed to the right path of libjvm.

thanks in advance, karen.


Solution

  • The JNI_GetCreatedJavaVMs as well as other JVM functions are located in JavaVM file, which can be found in /System/Library/Frameworks/JavaVM.framework/ directory.