RXTX库在Ubuntu上失败了

时间:2013-12-11 15:08:32

标签: java linux rxtx

尝试在Ubuntu机器上运行java programm。当程序试图打开com端口时,Java程序正在使用RXTX库并崩溃:

java.lang.UnsatisfiedLinkError: /opt/pnt/lib/librxtxSerial.so: /opt/pnt/lib/librxtxSerial.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch) thrown while loading gnu.io.RXTXCommDriver
Exception in thread "main" java.lang.UnsatisfiedLinkError: /opt/pnt/lib/librxtxSerial.so: /opt/pnt/lib/librxtxSerial.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1750)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1675)
    at java.lang.Runtime.loadLibrary0(Runtime.java:840)
    at java.lang.System.loadLibrary(System.java:1047)
    at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:83)
    at Serial.tSerial.connect(tSerial.java:565)
    at protocol.Msg.open(Msg.java:196)
    at protocol.Msg.getMsg(Msg.java:66)
    at jeasi.MyHandler.<init>(MyHandler.java:56)
    at jeasi.MyHandler.main(MyHandler.java:665)

可能出现什么问题?

启动程序脚本:

cd /opt/pnt;
/usr/bin/java -Djava.library.path=/opt/pnt/lib -cp /opt/pnt/lib/commons-codec-1.5.jar:/opt/pnt/lib/log4j.jar:/opt/pnt/lib/RXTXcomm.jar:/opt/pnt/bin:. pr.MyHandler

1 个答案:

答案 0 :(得分:0)

您正在运行64位JVM,并且只安装了32位版本的rxtx。您应该转到页面上列出的forks of rxtx之一并下载该库的64位编译版本。

mfizz.com版本似乎最容易下载x64库的副本。