- Check if you have installed the library. If not, in case of Ubuntu,
sudo apt-get install librxtx-java
- If already installed,
go to the path of the installation --- in my case
/usr/share/java/RXTXcomm.jar
- If you are using Ubuntu or any Linux distro, remove any downloaded rxtx library from Eclipse build path, and add the path of the installed rxtx library in step 2. You can also copy it into your project.
- Check your java library property (
System.getProperty("java.library.path")
) to know the folder. - Copy the
librxtxSerial.so
to the Java library path - in my casesudo cp -r /usr/lib/jni/librxtxSerial.so /usr/lib/x86_64-linux-gnu
After that try your code again.