How to add rxtxSerial in java.library.path?

Aditya Ponkshe picture Aditya Ponkshe · Feb 19, 2013 · Viewed 57.8k times · Source

I am developing an application in Java using Eclipse IDE. My os is Ubuntu 11. My application is using the RXTX library (gnu.io.*) for serial communication. I have added the RXTXomm.jar file in project by doing this (project->Properties->java buld path->add external jars). whenever I run my code it gives me this error.

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

I even tried installing librxtx-java.deb. but it did not fix the problem. I searched around in file system and found that librxtxSerial.so is located in /usr/lib/jni.

How can I fix this issue?

Thanks in advance

Answer

martijno picture martijno · Feb 19, 2013

Find your jar in Project -> properties -> Java build path. Click on the + to open the JAR's properties, select Native library location and edit it to point to RXTX's shared library (.DLL, .so, .dylib).