no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver in Mac OS 10.12.2

4.3k views Asked by At

I am developing an application in Java using Eclipse IDE. My os is Mac OS 10.12.2 . My application is using the RXTX library (gnu.io.*) for serial communication, added in my pom.xml

<dependency>
            <groupId>org.rxtx</groupId>
            <artifactId>rxtx</artifactId>
            <version>2.1.7</version>
</dependency>

I have added also librxtxSerial.jnilib file in project by doing this (project->Properties->java buld path->addjars). 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
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:83)
1

There are 1 answers

0
howlger On BEST ANSWER

You have to add the location of the folder that contains librxtxSerial.jnilib as Native library location:

  1. Right-click project and choose Properties
  2. In Java Build Path, in the Libraries expand the RXTX JAR node
  3. Select the subnode Native library location: (None) and click Edit
  4. Enter the folder location that contains librxtxSerial.jnilib and click OK