문제

My java code calls via JNI some C++ code from a shared library (eg libtest.so). The code is instrumented with some special debugging symbols that exist it libdebug.so. When I call

LD_PRELOAD=/usr/lib/libdebug.so java com.test.myMain

the execution stops with Exception in thread "main" java.lang.UnsatisfiedLinkError

because symbols from libdebug.so are not loaded (why?).

I was wondering if it is possible to modify my code in order to PRELOAD the library inside my java code. (Of course I don't want to compile java with libdebug.so...)

도움이 되었습니까?

해결책

System.load can be used to load any shared library, so you might try loading the debug library in a static block using System.load (before you load your JNI lib). Or try System.loadLibary("debug") before your JNI lib.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top