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.
- 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.