Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JNI + Solaris : LD_LIBRARY_PATH / java.library.path initialisation

843829Jan 24 2007 — edited Jan 24 2007
Hello.

Some JNI tools have been built to run on both windows and Solaris.
For the windows part, The PATH has been modified to add the DLL in order to be able to load the library into the JVM.
After some hard time to get the DLL build process doing his job, finally every thing worked.

But in Solaris, I can't have the library loaded (of course the library is build on Solaris ; a so file).
In a shell I try to launch some unit testing but every tries failed.
I tried to log the value of java.library.path and it remains empty on Solaris.

I think it's the environment variable that is not set properly. But I don't know what's wrong.


Here is the shell :
------------
...
[ -z "$MOTEUR_HOME" ] && MOTEUR_HOME=`pwd`

# d�finition du r�pertoire des archives
LIBDIR="$MOTEUR_HOME/lib"

...

# classe � lancer
_main=org.junit.runner.JUnitCore

# tests � lancer
_tests=fr.mediapost.itineraire.moteur.MoteurImplTest

# le r�pertoire contenant les moteurs
_libpath="$MOTEUR_HOME/moteur"

#classpath
_CP=$MOTEUR_HOME:$MOTEUR_HOME/configuration:$LIBDIR
if [ -d "$LIBDIR" ]; then
  for i in "$LIBDIR"/*.jar; do
    _CP="$_CP":"$i"
  done
fi
...
#   echo CLASSPATH : $_CP
   echo JAVA_HOME : $JAVA_HOME
   echo MOTEUR_HOME : $MOTEUR_HOME
   echo Moteur : $_libpath

LD_LIBRARY_PATH=$_libpath
export LD_LIBRARY_PATH

# lancement
$JAVA_HOME/bin/java -DMOTEUR_HOME=$MOTEUR_HOME -Djava.library.path=$_libpath -DLD_LIBRARY_PATH=$_libpath -cp $_CP $_main $_tests
------------

The output is :
------------
MOTEUR_HOME : /export/home/users/sylvain.mougenot/moteur
Moteur : /export/home/users/sylvain.mougenot/moteur/moteur
JUnit version 4.1
09:57:12,361 DEBUG [MoteurImplTest] testCalculerInterface() - java.library.path=
...
Caused by: java.lang.UnsatisfiedLinkError: no libMoteur in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
------------

The libMoteur.so file is in the directory associated to the shell variable $_libpath.

Can someone tell me what I've to do to fix it?
Could the so file be found but Java can't load it?

Message was edited by:
SMougenot
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 21 2007
Added on Jan 24 2007
1 comment
431 views