I’m doing some research regarding how HotSpot performs garbage-collection and/or heap-compaction while JNI code is running. It appears to be common knowledge that objects could be moved at any time in Java. I’m trying to understand, definitively if JNI is subject to effects garbage-collection. There exist a number of JNI functions to explicitly prevent garbage-collection; such as GetPrimitiveArrayCritical. It makes
Tag: java-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: 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
How to influence search path of System.loadLibrary() through Java code?
In a Java project, I am using a third-party library that loads some native library via I’d like to be able to influence the search path of this method from within my application, so that the user doesn’t need to specify a correct java.library.path value on the command line (this value depends on the current OS and architecture). E.g on
How can I tell if I’m running in 64-bit JVM or 32-bit JVM (from within a program)?
How can I tell if the JVM in which my application runs is 32 bit or 64-bit? Specifically, what functions or properties I can used to detect this within the program? Answer You retrieve the system property that marks the bitness of this JVM with: Possible results are: “32” – 32-bit JVM “64” – 64-bit JVM “unknown” – Unknown JVM