'How to Build native-image with vlcj

I am try to build a javafx program with vlcj-javafx library,it running great in jvm,but then i trying to build it to a native-image with gluonfx plugins,it have this error on running:

[INFO] [SUB] Exception in thread "main" java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/win32-x86-64/jnidispatch.dll) not found in resource path ()
[INFO] [SUB]  at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1059)
[INFO] [SUB]  at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:1015)
[INFO] [SUB]  at com.sun.jna.Native.<clinit>(Native.java:221)
[INFO] [SUB]  at com.sun.jna.NativeLibrary.<clinit>(NativeLibrary.java:87)
[INFO] [SUB]  at ink.bluecloud.vlcjjfx.VlcjJavaFxApplications.<clinit>(VlcjJavaFxApplications.kt:30)

The line of VlcjJavaFxApplications.kt is :

NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), "C:\\Users\\Anivie\\Desktop\\vlc-3.0.16")

So i try to add jna dependency in my gradle,it like this now:

dependencies {
    implementation 'uk.co.caprica:vlcj-javafx:1.0.3'
    implementation 'net.java.dev.jna:jna:5.10.0'
    implementation 'net.java.dev.jna:jna-platform:5.10.0'
}

But this error still exists.

This is my build command:

gradlew nativeRunAgent
gradlew nativeBuild
gradlew nativeRun

I am using the shadow plugin to make a jar file, this dll is included in it. How can I fix it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source