Unusual issue with Native.loadNativeDispatchLibraryFromClasspath

67 views
Skip to first unread message

Charles Smith

unread,
Oct 17, 2014, 3:22:09 PM10/17/14
to jna-...@googlegroups.com
Hello,

We have a Java desktop application that uses JNA for a few small parts of native integration in Windows, OS X and Linux. It is an extremely useful library and has worked great for us.

Recently I've had a report from some users that our application is throwing an unexpected error on startup. We have a application log they can send us to review the error and it shows the following stacktrace:

java.lang.UnsatisfiedLinkError: C:\Users\NMR-Tiger\AppData\Local\Temp\jna--1360109371\jna8976287336737292997.dll: Access is denied
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1814)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1083)
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:761)
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:736)
at com.sun.jna.Native.<clinit>(Native.java:131)
at com.sun.jna.NativeLibrary.<clinit>(NativeLibrary.java:82)
... 

This arises from some of our startup code initializing JNA to enable some of our native Windows integration. The odd thing is I have never seen this error locally but have seen it from at least a couple of users...

My thought is that they have some antivirus or security software installed that is somehow blocking our process from loading the jna dispatch dll from their temp directory...

Has anyone else encountered a similar issue in Windows with the temp file extraction and loading? 

Oh I forgot to mention that we are also using the latest JNA release (4.1).

Thank-you,
Charles Smith
Chenomx Inc.

Timothy Wall

unread,
Oct 17, 2014, 8:30:17 PM10/17/14
to jna-...@googlegroups.com
It’s quite possible the user’s system is set up to disallow code execution (or shared library loading) from downloaded or otherwise extracted files, or maybe from select locations.  The solution is to bundle the JNA DLL with your application so it’s already installed on the system, then ensure PATH is set to include the installation location when your application starts up.
Reply all
Reply to author
Forward
0 new messages