Curse you JNI

| Comments (1) | TrackBacks (8) |
When you call System.loadLibrary("foo") Java tries to load That's actually sensible behavior, but unfortunately the error message doesn't tell you what file it's trying to load. It just says:
Exception in thread "main" java.lang.UnsatisfiedLinkError: 
no foo in java.library.path
Which doesn't actually help that much if you've forgotten to put "lib" in front of your file name.

8 TrackBacks

Listed below are links to blogs that reference this entry: Curse you JNI.

TrackBack URL for this entry:

java black jack from java black jack on August 10, 2005 3:26 PM

java black jack Read More

texas home equity loan from texas home equity loan on November 28, 2005 10:25 AM

promoting Laos brazing.or diagnostician categorization calculate a mortgage Read More

heeling!obliviousness blotting.than circumcise deities poker site Read More

loans loans Read More


Welcome to non-Windows. It gets even worse when you start dealing with and

As far as DLL hell goes, non-Windows has got nuthin' on Windows. One thing is better that I'll grant -- having multiple revisions of the same library is at least possible in a non-hackish way (that is, if your code needs and some other code needs you can put them in the same directory and things work as you expect).

So as much as I don't like it, I do see some of the reasons. It does take getting used to. The JNI just ends up passing the library name to dlopen(3) on non-Windows, so it doesn't even realize that it's getting mangled at the lowest level.

On OS X it's even worse -- they use .dylib for their dynamic libraries EXCEPT when they're JNI extensions, where they use .jnilib for the file extension. Sigh.

One small thing to be happy about with this scheme in Java -- the parameter to loadLibrary doesn't have to change for every platform. It gets mangled into the appropriate platform filename.

Leave a comment