Java: util_USBUIRT.dll: Can't find dependent libraries

本小妞迷上赌 提交于 2019-12-06 12:53:44

The dlls in the mentioned jar are 32 bit. The environment is Win7 x64. I assume the JVM is 32 bit otherwise there would be another error, ie: Can't load IA 32-bit .dll on a AMD 64-bit platform or similar.

Try copying the dlls into C:\Windows\SysWOW64 rather than C:\Windows\System32. 32 bits dlls should go into C:\Windows\SysWOW64. It worked for me, although I got util.USBUIRT$NotInitializedException which is probably the indication the libraries were loaded properly.

File System Redirector article may shed some light on SysWOW64 vs System32.

EDIT: tweaking java.library.path

You may also go with a solution mentioned in comments, for example, copy dlls into C:\tmp and run with argument:

-Djava.library.path="C:\tmp;${env_var:PATH}"

But since there is a dependency between the two dlls, C:\tmp must be on PATH. Otherwise there is still UnsatisfiedLinkError. Manually loading uuirtdrv.dll should help, ie:

import util.USBUIRT;
public class Uirt {
    static {
        System.loadLibrary("uuirtdrv");
    }

public static void main(String[] args) {
    String code = "0000";   
    try {
        USBUIRT.transmitIR(code, 2, 3, 2);
    } catch (Exception e) {
        e.printStackTrace();
    }
  }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!