Martin Walzl Martin Walzl - 10 months ago 91
C++ Question

Can't load IA 32-bit .dll on a AMD 64-bit platform JNI

I have a Problem :D im working on a self generated DLL with JNI.
I have generated the DLL with Visual Studio 2013, for 64Bit machines. I have already checked with Dependency Walker if my DLL is really 64 Bit, and it is. Then i tried to use the DLL in my Java source (Eclipse Version: Luna Service Release 1 (4.4.1) Java Version 1.7.0_71-b14 64 Bit Version).

When i run my Java Programm i get the errormessage Can't load IA 32-bit .dll on a AMD 64-bit platform in this line.


I have already spend 2 days in this problems and searched stackoverflow and some other forums. I'm really out of Ideas what could possibly be wrong.

So far and in the hope you guys and girls can help

Answer Source

Java uses the system property java.library.path as the path to find native libraries. When you start your application, define this property on the command line with the -D option and make it point to the directory that contains the DLL. For example:

C:\MyProject> java -Djava.library.path=C:\MyProject\nativelib com.mypackage.MyProgram

where C:\MyProject\nativelib is the directory that contains the DLL you want to use.