0

Essentially, the question is this. I have a Java program from which I load a JNI library. Can that JNI library be linked to HotSpot's libjvm.so shared library, and accordingly call functions unique to HotSpot - that is, outside of jni.h?

When I try and do so in a straightforward way, the result is the program crashing with:

java: symbol lookup error: /path/to/libtest.so: undefined symbol: _ZNK7oopDesc5klassEv

This gives the appearance of failing to load because it can't resolve the HotSpot-unique oopDesc class. Any suggestions for producing a library that can be linked in such a manner?

Edit: Tried also linking to libjava.so at compile-time with no success.

0x277F
  • 13
  • 4

1 Answers1

0

If the libjvm.so that you want to load is different than the libjvm.so that is implicitly linked by the java EXE, this is not going to work, because they will conflict unless you do something like this trick or that trick. Is the java EXE loading the same libjvm.so that your library wants to reference? You should be able to tell which .so is loaded by java EXE as described here.

If the java EXE and your library both want the same .so and it is still not working, I don't know what to say.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Wheezil
  • 3,157
  • 1
  • 23
  • 36