我在使用来自Java JNI的其他.c文件中的其他C函数调用C函数时遇到问题(不要介意我的代码中的一些法语单词,谢谢)。C 中的代码工作正常。
以下是我用来编译库的两行。我正在使用我在第二个库中使用的函数编译我的第一个库。告诉我,如果我做错了,能够做到这一点:
gcc -fPIC -shared -I"$$JAVA_HOME/include" -I"$$JAVA_HOME/include/linux" -o Libraries/libfilemot.so ../IndexationTexte/fileMot.c
gcc -fPIC -shared -I"$$JAVA_HOME/include" -I"$$JAVA_HOME/include/linux" ../IndexationTexte/indexationV1.c -L./Libraries/ -l:libfilemot.so -o Libraries/libindexation.so
在我的Java类中,我有这个:
public class MoteurDeRecherche {
static {
try {
System.load("/home/aurelien/Documents/Projects/Projet_fil_rouge/noyau_c/JNI/Libraries/libfilemot.so");
System.load("/home/aurelien/Documents/Projects/Projet_fil_rouge/noyau_c/JNI/Libraries/libindexation.so");
}
catch(UnsatisfiedLinkError e) {
System.out.println("Erreur de chargement des librairies :\n" + e);
System.exit(1);
}
}
public static native void indexationTexte();
public static void main(String args[]) {
MoteurDeRecherche.indexationTexte();
}
}
但是我收到这个错误来自我的库,它编译成功:
Erreur de chargement des librairies :
java.lang.UnsatisfiedLinkError: /home/aurelien/Documents/Projects/Projet_fil_rouge/noyau_c/JNI/Libraries/libindexation.so: libfilemot.so: cannot open shared object file: No such file or directory
如果您想了解更多信息,请不要犹豫。再次感谢你。
慕的地8271018
慕尼黑5688855
相关分类