无法在 AMD 64 位平台 JNI 上加载 IA 32 位 .dll [英] Can't load IA 32-bit .dll on a AMD 64-bit platform JNI

查看:24
本文介绍了无法在 AMD 64 位平台 JNI 上加载 IA 32 位 .dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题:我正在使用 JNI 处理自生成的 DLL.我已经使用 Visual Studio 2013 为 64Bit 机器生成了 DLL.我已经用 Dependency Walker 检查过我的 DLL 是否真的是 64 位,并且确实如此.然后我尝试在我的 Java 源代码中使用 DLL(Eclipse 版本:Luna Service Release 1 (4.4.1) Java 版本 1.7.0_71-b14 64 位版本).

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

当我运行 Java 程序时,在这一行中收到错误消息无法在 AMD 64 位平台上加载 IA 32 位 .dll.

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.

     static 
     {
         System.loadLibrary("iomemjava");
     }

我已经在这个问题上花了 2 天时间并搜索了 stackoverflow 和其他一些论坛.我真的没有想法可能是错的.

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 Martin

推荐答案

Java 使用系统属性 java.library.path 作为查找本机库的路径.启动应用程序时,在命令行上使用 -D 选项定义此属性,并使其指向包含 DLL 的目录.例如:

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
ativelib com.mypackage.MyProgram

其中 C:MyProject ativelib 是包含您要使用的 DLL 的目录.

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

这篇关于无法在 AMD 64 位平台 JNI 上加载 IA 32 位 .dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆