NicholasAStuart / myo-java

Java API for Thalmic's Myo Device
Apache License 2.0
41 stars 27 forks source link

Loading library on Windows #7

Closed mediatecture closed 9 years ago

mediatecture commented 9 years ago

I'm having issues loading the library on Windows 7 (64 bit) (running Myo 0.8.1). FYI, I've also tested this in a 32-bit environment. I receive the following error message:

Unable to load myo64 from system directories.
Unable to load myo32 from system directories.
Unable to load myo64.dll from directory C:\Users\ENCOUN~1\AppData\Local\Temp.
java.lang.UnsatisfiedLinkError: C:\Users\Encounters\AppData\Local\Temp\myo64.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(Unknown Source)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at com.thalmic.myo.Hub.copyAndLoadX64FromTemp(Hub.java:185)
    at com.thalmic.myo.Hub.loadJniResources(Hub.java:81)
    at com.thalmic.myo.Hub.<init>(Hub.java:25)
    at com.thalmic.myo.Hub.<init>(Hub.java:20)
    at MyoOSC.setup(MyoOSC.java:92)
at java.lang.Thread.run(Unknown Source)
Unable to load myo32.dll from directory C:\Users\ENCOUN~1\AppData\Local\Temp.
A library relies on native code that's not available.
Or only works properly when the sketch is run as a 64-bit  application.

Can you clarify how this issue can be solved? I must also note, similar to the loading issue on Mac (https://github.com/NicholasAStuart/myo-java/issues/5), files seem to be physically copied to the TEMP folders.

Thanks!

NicholasAStuart commented 9 years ago

I believe this issue is that you are using a 32-bit JVM. Make sure your JVM is 64-bit.

mediatecture commented 9 years ago

Thanks for following up. I was running a 64-bit JVM (7u75), however the same error message keeps popping up. Do you happen to know which Windows versions support the library straight out of the box?

NicholasAStuart commented 9 years ago

I hate to press a point, but the only time I've seen this myself is when there is a 32-bit JRE/JDK being run with the code. Can you make sure that however you are launching your code with my JAR in it, that it is using the proper JDK.

In Eclipse, you can check this by playing with the build settings of your project.

mediatecture commented 9 years ago

Thanks again. Did some more extensive research into this. I'm definitely using a 64-bit JVM. With some breakpoints throughout the code, myo64.dll seems to load without any problem, yet the loading halts on JNIJavaMyoLib.dll (both when loading via SysPath as via Temp, including a hardcoded directory mapping).

java.lang.UnsatisfiedLinkError: C:\Users\Encounters\AppData\Local\Temp\JNIJavaMyoLib.dll: Can't find dependent libraries
mediatecture commented 9 years ago

Only by looking into the output from Process Monitor, I noticed MSVCP100.dll was required (which required an install of VC++). I was testing on a Windows 7 clean install...

You may want to mention this in the documentation, though?

Cheers!

NicholasAStuart commented 9 years ago

I did not realize it was required. I must have added it a while back for something else and never gave it a second though. Thanks for doing the leg work, I'll try to make a doc update.