aspose file tools*
The moose likes Spring and the fly likes Spring 3 and load JNI/.so library Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring 3 and load JNI/.so library" Watch "Spring 3 and load JNI/.so library" New topic
Author

Spring 3 and load JNI/.so library

andrea mucci
Greenhorn

Joined: Aug 12, 2011
Posts: 4
Hi all

My question is:

how is possible to dinamic load JNI or .so file from spring.
in my project i have a lib where i have added different jar files and all work well but if i add the library jar with a jnilib file ( for example in a mac osx leon ) when i charge the library


i obtain this error
java.lang.UnsatisfiedLinkError: no chilkat in java.library.path

so, have a method to use the jsni or .so library without move de shared library to hava.library.path?

thank's
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

This is handled by the JVM - Spring doesn't really have anything to do with it.

Is this your code or a third party library you are using? If it's your code, you can use System.load() instead of System.loadLibrary() - System.loadLibrary() only loads from the java.library.path, but System.load() can load from any location. Some libraries package their native dependencies inside their JAR, extract them to a pre-defined location, and use System.load() to load them from that location.

If it's a third party library using System.loadLibrary(), it's probably easier to just add to the java.library.path - you can either set the PATH environment variable to point to the directory that contains the library, or specify java.library.path when starting the JVM - this is done by setting the property - by passing -Djava.library.path=... as a command-line argument.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
andrea mucci
Greenhorn

Joined: Aug 12, 2011
Posts: 4
Thank's Nath

mmmm, my problem is that i work with an hosting system, cloudfoundry.com and i can't modify the jvm instances.
the library is JavaCV a wrapper of openCV

anyway, thank's for your help
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring 3 and load JNI/.so library