6

I'm trying to use maven-shade-plugin to relocate a library. Unfortunately, this library also includes some native implementation.

The problem I'm facing is that after relocation to a different package, when trying to call the native methods from that library, I get UnsatisfiedLinkError.

I guess the problem arises because of how native method names are resolved (the java counterpart has a different package after relocation).

Is there any known way around this?

sergiuprdn
  • 61
  • 4
  • 1
    Create an adapter library that will redirect functions with new names to the original library. Alternatively call JNI [RegisterNatives](https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/functions.html#RegisterNatives) to manually bind Java native methods to the functions from the original library. – apangin Mar 01 '18 at 23:36
  • thanks, your solution will work; however it has the disadvantage that any changes to the API of the native library might result in UnsatisfiedLinkError – sergiuprdn Aug 23 '19 at 08:17

0 Answers0