Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring 3 and load JNI/.so library

 
andrea mucci
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
andrea mucci
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic