Cannot find my DLL for Spark plugin

On Windows I have a plugin that uses JNI to call a native function in a DLL. I have Starting Spark with Spark.exe always gives java.lang.UnsatifiedLinkError : no DLL on java.library.path. If I just “run java org.jivesoftware.launcher.Startup” with the DLL on the PATH, it works and my JNI native function is called.

I have tried my DLL in several different directories, where {Spark} is the Spark install directory:

{Spark}

{Spark}\plugins

{Spark}\resources

c:\windows\system32

I also tried it in the lib directory of my jar file for the plugin.

I print out the value of java.library.path and it includes a number of directories, e.g. {Spark}\resources, but still it gives me the error.

I finally tried {Spark}\lib\windows and it works.

So, what IS the right way? Where should/can these DLLs go to be found by the plugin?

From the documentation, it says about the lib directory

lib/ ← The main classes and libraries needed to run your plugin.

The various other posts from years ago don’t give any clear description of what should be done.

Can someone please shed some light

Thanks