title: java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path on Ubuntu 14.04 Jamod Serial
body: <p>I'm trying to establish connection with device connected in COM1 port using Jamod serial master code. The following is my code:</p>
  
  <pre><code>SerialConnection connection = null;
  public void connection() {
      ModbusCoupler.getReference().setUnitID(1);
      SerialParameters params = new SerialParameters();
      params.setPortName("COM1");
      params.setBaudRate(9600);
      params.setDatabits(8);
      params.setParity("None");
      params.setEncoding(Modbus.SERIAL_ENCODING_ASCII);
      params.setEcho(false);
      params.setStopbits(1);
  
      try {
          connection = new SerialConnection(params);
          connection.open();
          connection.close(); 
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>I'm using Maven and running this code on Ubuntu 14.04. I followed this <a href="http://www.jcontrol.org/download/readme_rxtx_en.html" rel="nofollow">link</a> to install RXTX in Ubuntu 14.04. I copied <code>librxtxSerial.so</code> to <code>/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/</code> and <code>RXTXcomm.jar</code> to <code>/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext</code>.</p>
  
  <p>The following is my maven code:</p>
  
  <pre><code>    &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;camel.version&gt;2.12.1&lt;/camel.version&gt;
      &lt;github.global.server&gt;github&lt;/github.global.server&gt; 
      &lt;camel-version&gt;2.16.2&lt;/camel-version&gt;
      &lt;junit-version&gt;4.11&lt;/junit-version&gt;
      &lt;log4j-version&gt;1.2.17&lt;/log4j-version&gt;
      &lt;slf4j-version&gt;1.7.12&lt;/slf4j-version&gt;
      &lt;jackson-version&gt;2.6.3&lt;/jackson-version&gt;
      &lt;build.serial.gnu&gt;true&lt;/build.serial.gnu&gt;
  &lt;/properties&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
          &lt;version&gt;1.6.4&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
          &lt;artifactId&gt;camel-core&lt;/artifactId&gt;
          &lt;version&gt;${camel.version}&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.servicemix.bundles&lt;/groupId&gt;
          &lt;artifactId&gt;org.apache.servicemix.bundles.jamod&lt;/artifactId&gt;
          &lt;version&gt;1.2_1&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;${junit-version}&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
          &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;
          &lt;version&gt;1.0.2&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
          &lt;artifactId&gt;camel-test&lt;/artifactId&gt;
          &lt;version&gt;${camel.version}&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.mockito&lt;/groupId&gt;
          &lt;artifactId&gt;mockito-core&lt;/artifactId&gt;
          &lt;version&gt;1.8.5&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;net.wimpi&lt;/groupId&gt;
          &lt;artifactId&gt;jamod&lt;/artifactId&gt;
          &lt;version&gt;1.2&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- http://mvnrepository.com/artifact/org.rxtx/rxtx --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.rxtx&lt;/groupId&gt;
          &lt;artifactId&gt;rxtx&lt;/artifactId&gt;
          &lt;version&gt;2.1.7&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;repositories&gt;
      &lt;repository&gt;
          &lt;id&gt;apache.snapshots&lt;/id&gt;
          &lt;name&gt;Apache Snapshots Maven Repository&lt;/name&gt;
          &lt;url&gt;http://repository.apache.org/snapshots&lt;/url&gt;
          &lt;releases&gt;
              &lt;enabled&gt;false&lt;/enabled&gt;
          &lt;/releases&gt;
          &lt;snapshots&gt;
              &lt;enabled&gt;true&lt;/enabled&gt;
          &lt;/snapshots&gt;
      &lt;/repository&gt;
      &lt;repository&gt;
          &lt;id&gt;zodiac-repository&lt;/id&gt;
          &lt;name&gt;Zodiac Milestone Repository&lt;/name&gt;
          &lt;url&gt;http://zodiac.springsource.com/maven/bundles/milestone&lt;/url&gt;
      &lt;/repository&gt;
      &lt;repository&gt;
          &lt;id&gt;com.springsource.repository.bundle.external&lt;/id&gt;
          &lt;name&gt;SpringSource Enterprise Bundle Repository - External Bundle Releases&lt;/name&gt;
          &lt;url&gt;http://repository.springsource.com/maven/bundles/external&lt;/url&gt;
      &lt;/repository&gt;
  &lt;/repositories&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.12.1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;systemPropertyVariables&gt;
                      &lt;net.wimpi.modbus.debug&gt;true&lt;/net.wimpi.modbus.debug&gt;
                      &lt;argLine&gt;-Djava.library.path=/usr/share/java&lt;/argLine&gt;
                  &lt;/systemPropertyVariables&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
              &lt;artifactId&gt;cobertura-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.5.1&lt;/version&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-site-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;reportPlugins&gt;
                      &lt;plugin&gt;
                          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                          &lt;artifactId&gt;maven-project-info-reports-plugin&lt;/artifactId&gt;
                          &lt;version&gt;2.4&lt;/version&gt;
                          &lt;configuration&gt;
                              &lt;dependencyDetailsEnabled&gt;false&lt;/dependencyDetailsEnabled&gt;
                              &lt;dependencyLocationsEnabled&gt;false&lt;/dependencyLocationsEnabled&gt;
                          &lt;/configuration&gt;
                          &lt;!-- simpler configuration without reportSets available for usual cases --&gt;
                          &lt;reports&gt;
                              &lt;report&gt;dependencies&lt;/report&gt;
                              &lt;report&gt;scm&lt;/report&gt;
                              &lt;report&gt;index&lt;/report&gt;
                          &lt;/reports&gt;
                      &lt;/plugin&gt;
                      &lt;plugin&gt;
                          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                          &lt;artifactId&gt;maven-javadoc-plugin&lt;/artifactId&gt;
                          &lt;version&gt;2.8&lt;/version&gt;
                          &lt;configuration&gt;
                              &lt;links&gt;
                                  &lt;link&gt;http://jamod.sourceforge.net/apidocs/&lt;/link&gt;
                                  &lt;link&gt;http://camel.apache.org/maven/current/camel-core/apidocs/&lt;/link&gt;
                              &lt;/links&gt;
                          &lt;/configuration&gt;
                      &lt;/plugin&gt;
                  &lt;/reportPlugins&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.3.2&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;encoding&gt;${project.build.sourceEncoding}&lt;/encoding&gt;
                  &lt;source&gt;1.5&lt;/source&gt;
                  &lt;target&gt;1.5&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.4.3&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;encoding&gt;${project.build.sourceEncoding}&lt;/encoding&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  &lt;/profiles&gt;
  </code></pre>
  
  <p>When I try to execute the code, I'm getting this following error:</p>
  
  <pre><code>    Caused by: java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path
      at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)[:1.8.0_91]
      at java.lang.Runtime.loadLibrary0(Runtime.java:870)[:1.8.0_91]
      at java.lang.System.loadLibrary(System.java:1122)[:1.8.0_91]
      at gnu.io.CommPortIdentifier.&lt;clinit&gt;(CommPortIdentifier.java:83)
      at net.wimpi.modbus.net.SerialConnection.open(SerialConnection.java:87)
      at modbus.Serial.connection(SerialDataSource.java:43) //connection.open()
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_91]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_91]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_91]
      at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_91]
      at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:408)
      at org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:279)
      at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:252)
  </code></pre>
  
  <p>I tried other solutions suggested on stackoverflow such as installing <code>librxtx-java</code> but getting same error. Please help me to solve this issue.</p>