Installing FANN on Java project and NativeLibrary.loadLibrary problems with 32bit/64bit
If you try to install FANN and get it working with a Java project you might run into a few problems. The whole process is explained on the fannj (the Java binding) project's wiki but not in great detail.
Installing Fannj
- Get fannj
- Store it somewhere and add the jar to your project.
- Get FANN
- Extract it somewhere.
- Set up the DLL by either:
- copying the fannfloat.dll to System32, or
- adding the following line before you try to use FANN:
System.setProperty("jna.library.path", [fannfloat.dll dir path]);
Solutions to common issues
No Java Native
"Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jna/Platform"
Solution: Download the JNA and add the jar to your project.
Can' find the FANN library
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'fannfloat': The specified module could not be found.
Solution: Add debugging code (or better yet: use a debugger) after you set the JNA library path
Mismatch between JDK and DLL - 64bit vs 32bit
Exception in thread "main" java.lang.UnsatisfiedLinkError: [ddl path]: Can't load IA 32-bit .dll on a AMD 64-bit platform
You are probably running a 64bit Java SDK while fannfloat.dll is 32bit. The solution for me was installing additional 32bit Java SDK and choosing it in the build path for my project.
Just added this helpful information to the FannJ wiki page. If you can think of other ways FannJ can be improved, let us know. Thanks!
ReplyDeleteGreat, glad I could help. :)
ReplyDeleteATM I got nothing, but I'll be sure to contact you guys if something comes to my mind.
This comment has been removed by the author.
ReplyDeletethis is only for PC, right??
ReplyDeletecan i run this fannj on device android using eclipse??
Огромное спасибо за помощь! )
ReplyDelete