【问题标题】:Serial port library giving error java.lang.UnsatisfiedLinkError:串口库给出错误 java.lang.UnsatisfiedLinkError:
【发布时间】:2016-09-28 17:41:51
【问题描述】:

我已经从这个链接http://rxtx.qbang.org/wiki/index.php/Main_Page 下载了这个库。我有很多页面,首先我通过构建路径方法添加并添加 RXTXcomm.jar。然后我还在这里添加了 C:\Program Files(86)\Java\jre7\lib\ext 文件夹也添加了这个 .jar 文件。然而,当我尝试在 Eclipse 上运行或编译我的程序时,我仍然会收到此错误

java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver
Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:123)
    at read1.TwoWaySerialComm.connect(TwoWaySerialComm.java:21)
    at read1.TwoWaySerialComm.main(TwoWaySerialComm.java:108)

【问题讨论】:

    标签: java eclipse serial-port


    【解决方案1】:

    您需要在启动程序时设置java.library.path。这将使 Java 能够找到用于与串行端口通信的本机 C 代码。

    【讨论】:

    • 我不知道在 Eclipse 中设置什么路径?
    • 在 Eclipse 中,当您运行程序时,会出现一个对话框,您可以使用该对话框来设置程序参数和 VM 参数。有关详细信息,请参阅this answer
    【解决方案2】:

    此库已被弃用。使用新的库,如 serialpundit、pyserial 等。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-06
      • 2012-03-24
      • 2019-11-27
      • 2012-02-24
      相关资源
      最近更新 更多