Re: Digest for jna-users@googlegroups.com - 3 updates in 1 topic

3 views
Skip to first unread message

Bo Vidar Göran Lundgren

unread,
May 29, 2024, 8:55:03 AMMay 29
to jna-...@googlegroups.com
Hi and thanks for answers - I am a real newbie to this. I extracted the jnidispatch.dll and put it in the installation_directory/lib and I also set the following arguments in Intellij which I use for installation:
"-Djava.library.path=lib" "-Djna.nounpack=true" "-Djna.nosys=true"
but then I get the following error:

024-05-29 14:51:30.788 ERROR An unrecoverable error has occurred: java.lang.UnsatisfiedLinkError: Could not find JNA native support
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1013)

 


On Wed, May 29, 2024 at 8:30 AM <jna-...@googlegroups.com> wrote:
"Bo Vidar Göran Lundgren" <vidar...@gmail.com>: May 28 06:23AM -0700

Hi Neil thanks for you answer but I am still confused, when I install the
application the DLL is not extracted. They seem to have a group policy that
permits the usage - do you know how I can get around this ?
"Daniel B. Widdis" <wid...@gmail.com>: May 28 09:56AM -0700

When the JNA library path is not specified and it's not present in any of
the expected locations described in the javadoc, JNA extracts that DLL from
the class path, and then saves it to a temporary location. The code where
it's saved to a temp file like the one you've shown is here:
https://github.com/java-native-access/jna/blob/40f0a1249b5ad03020b5a2b66f42b9546e6d4edf/src/com/sun/jna/Native.java#L1165-L1184
 
As you can see in that code block, you can set jnidispatch.preserve to
automatically delete that temp file on (clean) exit (in OpenJDK, at least.)
 
As Neil said, the best way to prevent this is to pre-extract the library
and save it in a known location that you make sure is available to JNA when
it starts up. Then it will never get to this temp file path.
 
On Tue, May 28, 2024 at 6:23 AM Bo Vidar Göran Lundgren <
 
--
Dan Widdis
Neil C Smith <ne...@codelerity.com>: May 28 08:04PM +0100

> As Neil said, the best way to prevent this is to pre-extract the library and save it in a known location that you make sure is available to JNA when it starts up. Then it will never get to this temp file path.
 
The following link is also possibly more useful and current than the
one I shared before, which doesn't seem to cover current default
behaviour - https://javadoc.io/static/net.java.dev.jna/jna/5.14.0/overview-summary.html#loading
 
Best wishes,
 
Neil
 
 
--
Neil C Smith
Codelerity Ltd.
www.codelerity.com
 
Codelerity Ltd. is a company registered in England and Wales
Registered company number : 12063669
Registered office address : 3rd Floor Suite, 207 Regent Street,
London, W1B 3HH, England
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to jna-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages