1

I am trying to use the thinkgear.dll library to connect with a NeuroSky Mindset.

The developer tools include a ThinkGear.java class, which is a wrapper around the thinkgear.dll. The dll is only 32 bit compatible. I get a Can't load IA 32-bit .dll on a AMD 64-bit platform error when trying to run the program. This is only going to be run on my computer, not distributed. I've read that I have to run the jre in 32 bit mode or something?

Also, I am not sure I have set up the library to reference it properly. How should I do that, starting with a brand new project, where should I put the dll and thinkgear.java to be able to use the methods in my NeuroSkyApp class? Sorry, I am very new to java, I don't really understand all of this yet.

Here is a screenshot of what I have in Eclipse:

Eclipse Screenshot

Charles
  • 50,943
  • 13
  • 104
  • 142

1 Answers1

2

You need to install a 32-bit JRE and configure the build environment for your project in Eclipse accordingly.

To add an external dll to your project, you might find useful information here: How to add native library to "java.library.path" with Eclipse launch (instead of overriding it)

Community
  • 1
  • 1
Dan
  • 1,539
  • 12
  • 23
  • I have a 32 bit jre installed, its at C:\Program Files (x86)\Java\jre7 – user2018829 Jan 28 '13 at 16:52
  • Try http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-choose_config_jre.htm However, using google to figure that out is not too complicated ;) – Dan Jan 28 '13 at 16:53
  • Okay, I have make it run in a 32 bit jre. But now I am getting:Exception in thread "main" java.lang.UnsatisfiedLinkError: project.ThinkGear.GetDriverVersion()I at project.ThinkGear.GetDriverVersion(Native Method) at project.NeuroSkyApp.createWindow(NeuroSkyApp.java:20) at project.NeuroSkyApp.main(NeuroSkyApp.java:8) – user2018829 Jan 28 '13 at 16:59
  • This is the NeuroSkyApp class, the get driver version is just a test to see if the dll loading worked. http://pastebin.com/Nf2rD0rx – user2018829 Jan 28 '13 at 17:00
  • That shows you that your dll is not found. Either specify the java.library.path variables accordingly (see above) or try to set the path in eclipse: http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-choose_config_jre.htm – Dan Jan 28 '13 at 17:01
  • I'm still not getting this. I configured it to run it in the 32 bit jre. I guess I am not referencing the dll correctly. How do I set the path in eclipse? Should I make a jar out of the ThinkGear.java file and make it have native dependencies, I kind of know how to do that. – user2018829 Jan 28 '13 at 17:13
  • I'm sorry but I don't know how to help you further. The links I provided describe how to set up your library path in eclipse. Alternatively, you can try to run the program from your command line. Then, you have to start java with -Djava.library.path=your_path – Dan Jan 28 '13 at 17:18
  • Okay, I have put the .dll in C:\Program Files (x86)\Java\jre7\bin because that was in the path it printed out. It is still getting the same error, is there a specific thing I have to do? – user2018829 Jan 31 '13 at 21:37
  • Perhaps you could try to let the PATH variable point to the location where the DLL is. Otherwise, I'm running out of ideas. – Dan Jan 31 '13 at 21:41
  • But doesn't my unsatisfiedlinkerror mean that java is having trouble loading the dll, as in it has it loaded, but can't find methods? – user2018829 Jan 31 '13 at 22:42
  • Perhaps your dll internally references methods in an external dll that cannot be found. – Dan Feb 01 '13 at 07:48