本文介绍了使用Eclipse的java.libary.path未检测到Jacob 1.14.3 DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现JACOB库以与某些付款设备(例如PINPAD)进行通信.我创建了一个Java项目,但是当主类执行在运行时中使用DLL的方法时,出现错误no jacob-1.14.3-x64 in java.library.path

I am trying to implement the library JACOB to communicate to some payments devices such as PINPADs. I have created a java project but when the main class execute the method that use the DLL in the runtime gives a error no jacob-1.14.3-x64 in java.library.path

在这里您可以找到我用来构建项目的内容:

  • 操作系统:Windows 10 64bit
  • JRE/JDK版本:1.8.0_181 64位*(从32位更改为64位)*
  • Eclipse:Photon版本(4.8.0)
  • Maven版本:3.5.4
  • JACOB版本:1.14.3(文件64 [x64]和32 [x86])

在这里您可以找到我已经尝试过的解决方案

  • Add the jacob.jar as external library and add the folder where the dlls as native library.
  • Use the command for the java library path –Djava.library.path=C:\Users\adazat\Downloads\ClienteImplantadoJava\jacob-1.14.3\

将dll文件添加到/Java/jdk/jre/bin/Java/jdk/jre/lib/ext

Added the dll files to /Java/jdk/jre/bin and /Java/jdk/jre/lib/ext

mvn install:install-file -Dfile=C:\Users\adazat\Downloads\ClienteImplantadoJava\jacob-1.14.3\jacob-1.14.3-x64.dll -DgroupId=jacob -DartifactId=jacob-dll -Dversion=1.14.3 -Dpackaging=dll -DgeneratePom=true

mvn install:install-file -Dfile=C:\Users\adazat\Downloads\ClienteImplantadoJava\jacob-1.14.3\jacob.jar -DgroupId=jacob -DartifactId=jacob-jar -Dversion=1.14.3 -Dpackaging=jar -DgeneratePom=true

  • 将依赖项添加到了maven pom.xml

我在堆栈溢出中搜索了不同的问题,但仍然无法尝试任何方法,我想知道某些问题是否存在类似的问题,以及我可以尝试解决什么问题.非常感谢您的时间:D

I have searched in different questions in stack-overflow and still does not work trying any approach, I would like to know if some has a kind of similar problem and what else iI could try, to solve it. I really appreciate your time :D

推荐答案

仅供参考,请参考您的原始问题:切换到64位JDK,因为无法从32位jre/jdk调用64位dll.

Just for reference, to your intitial question: Switch to a 64Bit JDK since a 64Bit dll can not be called from a 32bit jre/jdk.

关于下一个错误:

在使用COM对象之前,必须在系统中注册该对象(例如,其CLSID或ProgID必须存在于Windows注册表中).如果未注册,则可以使用regasm.exe实用程序执行此操作:

Before using a COM object, it must be registered in the system (e.g. its CLSID or ProgID must exist in the Windows Registry). If its not registered, regasm.exe utility can be used to do that:

使用:Regsvr32 PathToDll

或者您也可以尝试:%systemroot%\Microsoft.NET\Framework64\vX.X\RegAsm.exe /verbose /nologo /codebase PINPAD.dll

(将vX.X替换为系统上安装的版本,例如v3.0或v4.0.30319.如果要使用32位dll,请使用...\Framework\...而不是...\Framework64\...)

(replace vX.X with the version installed on your system e.g. v3.0 or v4.0.30319. If you want to use the 32bit dll use ...\Framework\... instead of ...\Framework64\...)

一旦注册了CoCreateInstance() API方法,即可用于获取对该对象公开的接口的引用并调用其方法.可以在此处中找到更多详细信息.

Once it’s registered CoCreateInstance() API method can be used to obtain a reference to an interface exposed by the object and call its methods. Furter details can be found here.

这篇关于使用Eclipse的java.libary.path未检测到Jacob 1.14.3 DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 04:52