Using native library (JNA) in plugin

已回答

Hello,

in my plugin, I'm loading a native library by using Native.load(..) and the corresponding .dll/.so are placed inside the resources folder. This is working fine and the library is usable when doing testing in a sandbox ide (gradle runPlugin) or directly copying the jar from build/libs/.

However, after publishing the library to Jetbrains Plugin Repository and subsequently installing it through there the .dll can no longer be found:

2023-07-26 20:08:13,861 [ 172136]   INFO - com.sun.jna.Native - Looking in C:\Users\malte\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\231.9225.16\lib\jna\amd64\jnidispatch.dll
2023-07-26 20:08:13,861 [ 172136]   INFO - com.sun.jna.Native - Trying C:\Users\malte\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\231.9225.16\lib\jna\amd64\jnidispatch.dll
2023-07-26 20:08:13,865 [ 172140] SEVERE - #c.i.o.p.Task - Unable to locate JNA native support library
java.lang.UnsatisfiedLinkError: Unable to locate JNA native support library
    at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:1018)
  at com.sun.jna.Native.<clinit>(Native.java:221)

Am I supposed to move the libraries somewhere else?
Thanks in advance :)

0

Please share what is your plugin on Marketplace.

0

It's this one:
https://plugins.jetbrains.com/plugin/22291

PS: I'm pretty new to IntelliJ Plugins and this is my first plugin :)

0

Please try putting the native libraries _next_ to your plugin.jar file in the ZIP distribution instead of packaging them into /libs/... of your plugin JAR file.

0

I am running into this issue. on my build.gradle.kts i have implementations for the jna dependencies.

Is there anything else that we needed to do? 

 

0

Nomar Morado This forum is no longer active. Please post a thread in https://platform.jetbrains.com/c/intellij-platform/5 and provide your Gradle build script and project layout, thanks.

0

请先登录再写评论。