简体   繁体   中英

Loading a dll in Java For Windows XP

I'm attempting to load a dll using the System.loadLibrary("myDllFile") that I built on a linux machine using Makefile. I get a

java.lang.UnsatisfiedLinkError c:\\test\\myDllFile.dll: can't load this .dll (machine code=0x101) on a IA 32-bit platform

exception when I run the main java class containing the loadLibrary statement. I'm attempting to run the java class on Windows XP. Do I need a separate dll for windows xp (32bit) and windows 7 (64 bit)?

That's correct. You'll have to port the native code to run on each OS, and link it separately.

However, if you actually have a .dll , and not a .so , it sounds like you may have cross-compiled for Win64, when you meant to do so for Win32. (Perhaps using MinGW?) If you have such a cross-compiler set-up, you should be able to specify building for Win32 vs. Win64. Alternatively, you can tell your 64-bit Linux system to pretend to be 32-bit using setarch i686 , if your Makefile happens to be ill-behaving.

If you have a Linux .so , it'll require quite a bit more work to port to Windows…

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM