Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I solved the problem.

For those who use osx version other than v10.5 and Apple's JDK (maybe jdk 6), not oracle's jdk.

If you get UnsatisfiedLinkError with JNI, CHANGE your native library file extension to ".jnilib". Though java.library.path property is set properly, JVM may not load native library if file extension is not ".jnilib" such as ".dylib".

According to apple's doc on https://developer.apple.com/library/mac/#documentation/Java/Conceptual/Java14Development/05-CoreJavaAPIs/CoreJavaAPIs.html "JNI libraries are named with the library name used in the System.loadLibrary() method of your Java code, prefixed by lib and suffixed with .jnilib. For example, System.loadLibrary("hello") loads the library named libhello.jnilib. Java HotSpot also recognizes .dylib as a valid JNI library format as of Mac OS X v10.5."

Maybe on v10.5, ".dylib" works. But in my case on v10.8.4, mountain lion, ".dylib" doesn't work.

If you get problem during java development on mac, FIND documentation on developer.apple.com as well as oracle's doc. Don't forget that you may use Apple's JDK.!!

click to hide/show revision 2
This solution is only for Glassfish on osx.

I solved the problem.

For those who use osx version other than v10.5 and Apple's JDK (maybe jdk 6), not oracle's jdk.

If you get UnsatisfiedLinkError with JNI, CHANGE your native library file extension to ".jnilib". Though java.library.path property is set properly, JVM may not load native library if file extension is not ".jnilib" such as ".dylib".

According to apple's doc on https://developer.apple.com/library/mac/#documentation/Java/Conceptual/Java14Development/05-CoreJavaAPIs/CoreJavaAPIs.html "JNI libraries are named with the library name used in the System.loadLibrary() method of your Java code, prefixed by lib and suffixed with .jnilib. For example, System.loadLibrary("hello") loads the library named libhello.jnilib. Java HotSpot also recognizes .dylib as a valid JNI library format as of Mac OS X v10.5."

Maybe on v10.5, ".dylib" works. But in my case on v10.8.4, mountain lion, ".dylib" doesn't work.

If you get problem during java development on mac, FIND documentation on developer.apple.com as well as oracle's doc. Don't forget that you may use Apple's JDK.!!

[UPDATE] This solution is only for Glassfish v3. It doesn't works for Play framework. I Just wrote after experimenting on glassfish. I'm so sorry confuse you. But I found a way for Play framework too and going to write about it right now~