0

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
vico
  • 17,051
  • 45
  • 159
  • 315

1 Answers1

0

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.

Anya Shenanigans
  • 91,618
  • 3
  • 107
  • 122
  • mfizz.com is compiled for centOS. It didn't work for me. – gkiko Mar 18 '14 at 08:02
  • You should ask another question, detail how you installed it, and detail what the error was as, unfortunately, it could be any reason why it didn't work. The fact that it's compiled for CentOS means nothing; I've successfully used libraries compiled for a wide variety of linux releases on a custom build of linux with no issues. – Anya Shenanigans Mar 18 '14 at 10:00