Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.UnsatisfiedLinkError: Unable to load library ----> JNA on Windows #725

Closed
azadigb opened this issue Nov 14, 2016 · 4 comments
Closed

Comments

@azadigb
Copy link

azadigb commented Nov 14, 2016

  1. Version of JNA and related jars ----> 4.2.2
  2. Version and vendor of the java virtual machine ----> Java 1.7.0_55 - 64bit
  3. Operating system ----> Windows 7
  4. System architecture (CPU type, bitness of the JVM)----> Intel Core I3- 2120
  5. Complete description of the problem
    I am trying to load the .dll file I have built from my C/C++ project on Windows 7. I have created a small piece of code in Java to load the library with JNA, but it gives me the following error.

Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'C:\Users\Local\Temp\libMCS.dll': Native library (win32-x86-64/C:\Users\Local\Temp\libMCS.dll) not found in resource path ([file:/C:/Users/Agolbamaki/workspace/test/bin/, file:/C:/Users/workspace/test/jna-4.2.2.jar])
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:277)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:403)
at com.sun.jna.Library$Handler.(Library.java:147)
at com.sun.jna.Native.loadLibrary(Native.java:502)
at com.sun.jna.Native.loadLibrary(Native.java:481)
at Loader.(Loader.java:43)
at HelloWorld.main(HelloWorld.java:61)

I guess it cannot find the .dll file eventhough it is copied in the current directory (almost in all the possible directories). I also tried to copy the .dll in a TEMP directory and load it by an absolute path.
It automatically adds a prefix to the library path (win32-x86-64/C:\PATH\Temp\libMCS.dll).

Thank you for your help

@matthiasblaesing
Copy link
Member

Please check that you have the Visual C++ Runtime 2010 64bit installed.

@twall
Copy link
Contributor

twall commented Nov 15, 2016

Are you setting the property "jna.library.path" to the location of your
DLL? Are all dependencies of that DLL in the same directory?

On Mon, Nov 14, 2016 at 1:40 PM, Matthias Bläsing notifications@github.com
wrote:

Please check that you have the Visual C++ Runtime 2010 64bit installed.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#725 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAuMrSzzuCATvfqEO-BcndbIiCBV8yusks5q-KsdgaJpZM4KxK_V
.

@matthiasblaesing
Copy link
Member

I'll asume the replies cleared the situation - feel free to reopen.

@mathcoder23
Copy link

Please check that you have the Visual C++ Runtime 2010 64bit installed.

thanks,this perplex very day。final now ok。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants