Adding a JNI library to the local Maven Repository

后端 未结 3 1782
盖世英雄少女心
盖世英雄少女心 2021-02-04 02:52

I wish to add a JNI library, including its shared object (.so) file to my project using Maven. Unfortunately it is not yet on a public repository so I guess I have to install it

3条回答
  •  悲哀的现实
    2021-02-04 03:41

    I include the .so in the jar and extra the platform specific shared library before loading it. This way it is deployed just like any other jar.

    An example of a project where this is done, with multiple .so for different platforms is https://github.com/peter-lawrey/Java-Thread-Affinity

    The main class to look at is https://github.com/peter-lawrey/Java-Thread-Affinity/blob/master/src/main/java/com/higherfrequencytrading/affinity/impl/NativeAffinity.java

提交回复
热议问题