Question about JDK-8024281 Mac OS X: stop relying on Apple's JavaVM Frameworks

David DeHaven david.dehaven at oracle.com
Fri Feb 20 18:34:37 UTC 2015


>>> Follow-up question here: I'm trying to use autoconf to identify the
>>> location of the proper include directories and libraries for subsequent
>>> use of libtool to create a .libjni JNI dynamic library.
>> 
>> You should be using .dylib for JNI libs these days.
> 
> Please excuse my ignorance, but
> 
> Why?
> And what's the difference?

.dylib is the standard extension used by the dynamic loader on OSX, .jnilib was originally used by Apples JRE specifically for JNI libraries and (I believe) we’ve never really supported it except to allow legacy applications to continue to work. We certainly no longer use it internally. For example, there was a time (before the OSX port was done) when it was used in JavaFX. When 7u6 was released and Oracle took over ownership of the OSX JRE, we switched everything over.

There is no functional difference, the files are exactly the same except there’s no guarantee that .jnilib will continue to be supported. And look at the loading mechanism in jdk; loading a JNI lib will first attempt to load using the .dylib extension then fall back on .jnilib for legacy support, so there’s a (admittedly pretty small) performance consideration since it has to do extra work to load a .jnilib library.

-DrD-



More information about the macosx-port-dev mailing list