Search code examples
javaeclipsemavendlljacob

Jacob 1.14.3 DLL no detected by the java.libary.path using Eclipse


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

Here you can find what I am using to build the project:

  • Operating System: Windows 10 64bit
  • JRE/JDK version: 1.8.0_181 64bit*( changed from 32 to 64bit )*
  • Eclipse: Photon Release (4.8.0)
  • Maven version: 3.5.4
  • JACOB version: 1.14.3 (Both files 64[x64] and 32[x86])

Here you can find the solutions that I already have try


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

  • Added the dependencies to maven pom.xml

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


Solution

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

    Regarding your next error:

    Can't co-create object

    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:

    Use: Regsvr32 PathToDll

    Or you may also try: %systemroot%\Microsoft.NET\Framework64\vX.X\RegAsm.exe /verbose /nologo /codebase PINPAD.dll

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

    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.