Skip to content

Tag: java-native-interface

Socket binding through JNI

I try to open a socket connection on a Linux machine through JNI. If I combine Java_Socket_socket and Java_Socket_bind in same C function, the JNI call works perfectly, but it doesn’t work when I run methods sequentially. This is my code Java code Output: If I create C program from this code, and as regular C program, gcc … &&

Difference between “native” keyword and @HotSpotIntrinsicCandidate annotation

Why use one over another and vice-versa? Which is more performant? Answer The javadoc comments for the @HotSpotIntrinsicCandidate annotation say the following: “The @HotSpotIntrinsicCandidate annotation is specific to the HotSpot Virtual Machine. It indicates that an annotated method may be (but is not guaranteed to be) intrinsified by the HotSpot VM. A method is intrinsified if the HotSpot VM replaces

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