alidili / SerialPortDemo

使用Java实现的串口通信示例,可在Windows、Linux、Mac系统上运行
https://blog.csdn.net/kong_gu_you_lan/article/details/80589859
Apache License 2.0
207 stars 111 forks source link

java.lang.UnsatisfiedLinkError #1

Closed zDream closed 6 years ago

zDream commented 6 years ago

java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1122) at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:123) at com.yang.serialport.manage.SerialPortManager.findPort(SerialPortManager.java:45) at com.yang.serialport.ui.MainFrame.initData(MainFrame.java:147) at com.yang.serialport.ui.MainFrame.(MainFrame.java:81) at com.yang.serialport.ui.MainFrame$3.run(MainFrame.java:314) at java.awt.event.InvocationEvent.dispatch$$$capture(InvocationEvent.java:311) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.awt.EventQueue.dispatchEvent(EventQueue.java:726) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

请问这是什么错误

alidili commented 6 years ago

缺少Java串口通信依赖的jar包

下载地址:http://download.csdn.net/detail/kong_gu_you_lan/9611334 内含32位与64位版本

使用方法: 拷贝 RXTXcomm.jar 到 JAVA_HOME\jre\lib\ext目录中; 拷贝 rxtxSerial.dll 到 JAVA_HOME\jre\bin目录中; 拷贝 rxtxParallel.dll 到 JAVA_HOME\jre\bin目录中; JAVA_HOME为jdk安装路径

zDream commented 6 years ago

java.lang.UnsatisfiedLinkError: C:\Program Files (x86)\Java\jdk1.8.0_144\jre\bin\rxtxSerial.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform thrown while loading gnu.io.RXTXCommDriver Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: C:\Program Files (x86)\Java\jdk1.8.0_144\jre\bin\rxtxSerial.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1845) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1122) at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:123) at com.yang.serialport.manage.SerialPortManager.findPort(SerialPortManager.java:45) at com.yang.serialport.ui.MainFrame.initData(MainFrame.java:147) at com.yang.serialport.ui.MainFrame.(MainFrame.java:81) at com.yang.serialport.ui.MainFrame$3.run(MainFrame.java:314) at java.awt.event.InvocationEvent.dispatch$$$capture(InvocationEvent.java:311) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.awt.EventQueue.dispatchEvent(EventQueue.java:726) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

zDream commented 6 years ago

照你说的, RXTXcomm.jar和 两个dll文件都拷贝了

alidili commented 6 years ago

操作系统和JDK用的是多少位的,RXTX的位数需要和它们相同

zDream commented 6 years ago

是不是java 不应该装在Program Files (x86) 这个文件夹中,而是该 装在Program Files 这个文件夹中?

zDream commented 6 years ago

应该是jdk的原因,等我重装试下

hawkinchina commented 4 years ago

咨询一下,我用的macos的系统; RXTX 依赖包是标准的吗? 支持maven下载? 另外,rxtxSerial.dll/rxtxParallel.dll 也是rxtx第三方标准的? or 自己的? RXTX 依赖包下载地址,内含32位与64位版本 拷贝 RXTXcomm.jar 到 JAVA_HOME\jre\lib\ext目录中; 拷贝 rxtxSerial.dll 到 JAVA_HOME\jre\bin目录中; 拷贝 rxtxParallel.dll 到 JAVA_HOME\jre\bin目录中;