RXTX library failed on Ubuntu

1k views Asked by At

Trying to run java programm, on Ubuntu machine. Java programm is using RXTX library and crashes when program is trying to open com port:

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)

What might be wrong?

Start programm script:

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

There are 1 answers

2
Anya Shenanigans On

You're running a 64bit JVM and only installed a 32bit version of rxtx. You should go to one of the forks of rxtx as listed on the page and download a 64bit compiled version of the library.

The mfizz.com Version seems to have the easiest to download copies of the library for x64.