Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1657 connectés 

  FORUM HardWare.fr
  Programmation
  Java

  [JAVA : JNI] Pb a l'execution avec library

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[JAVA : JNI] Pb a l'execution avec library

n°741531
TheSebest
Posté le 27-05-2004 à 13:56:40  profilanswer
 

Bonjour,
 
J'ai un fichier NPDom.java avec des méthodes natives et a la fin static { System.loadLibrary("NPDom" ); }
La library se nomme "libNPDom.so"
Ces deux fichiers sont dans le meme repertoire.
 
quand je fais echo $LD_LIBRARY_PATh j'ai .:
 
quand je fais java Main j'ai :  
Exception in thread "main" java.lang.Unstatisfied LinkError : no NPDom in java.library.path
   at java.lang.ClassLoader.loadlibrary(ClassLoader.java:1668)
   at ...
 
quand je fais java Main -Djava.library.path=. Main j'ai  
Exception in thread "main" java.lang.Unstatisfied LinkError :  
/home/theseb/Documents/Java/libNPDom.so : /home/theseb/Documents/Java/libNPDom.so : ELF file data encoding not little-endian
   at java.lang.ClassLoader$NativeLibrary.load(Native Method)
   at ...
 
PS : compilation avec java -source 1.5
 
Quelqu'un peut t il m'aider ?


Message édité par TheSebest le 27-05-2004 à 13:57:48
mood
Publicité
Posté le 27-05-2004 à 13:56:40  profilanswer
 

n°741574
gfive
Posté le 27-05-2004 à 14:19:41  profilanswer
 

c'est ta librairie qui est pas compilée comme il faut.
Elle est codée en BigEndian, au lieu de LittleEndian (http://www.ordiworld.com/jargon/L/little_endian.html pour avoir des infos là dessus) : ton .so a dû être compilé avec un truc bizarre, je pense.

n°741841
pascal34
one point !
Posté le 27-05-2004 à 16:01:02  profilanswer
 

...ou sur une aure plateforme UNIX

n°741887
TheSebest
Posté le 27-05-2004 à 16:14:55  profilanswer
 

Ca y'est j'ai reussi mais je ne sais pas vraiment pourquoi.
Je te remercie.
 
A la fac je suis obligé de compiler comme ceci :  
> gcc -fPIC -c alloc.c
> gcc -fPIC -c listgen.c
> gcc -fPIC -c listNP.c
> gcc -fPIC -I/opt/JAVA/j2sdk1.5.0/include -I/opt/JAVA/j2sdk1.5.0/include/solaris -c NPDom.c  
> gcc -shared alloc.o listgen.o listNP.o NPDom.o -o NPDom.so
 
(-fPIC : option is to tell the compiler to create Position Independent Code )
 
Par contre chez moi sous mandrake 10.0 je viens de recompiler cette library avec l'option -fPIC et sans l'option -fPIC et la ca marche.
 
Vive la fac !?!?!
 
PS : j'espere que ca marchera aussi a la fac!!!


Message édité par TheSebest le 27-05-2004 à 16:16:00

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Java

  [JAVA : JNI] Pb a l'execution avec library

 

Sujets relatifs
execution de programme[JAVA] Comment inclure un Jar à la compilation ?
[JAVA] ANT :mettre un timestamp plusieurs fois de suite sur un fichier[Java] question sur le Timer de javax.swing
[java] base de données et enregistrement[Java 1.5] Probleme avec les types generiques
tubes en javajava 3D
[java] [Débutante]JinternalFrame et JOptionPanelancement automatique d'un prog java
Plus de sujets relatifs à : [JAVA : JNI] Pb a l'execution avec library


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR