I used RXTX library in the past years a lot. In most cases with Apache ANT. But now I wanted to create a new project based on Maven3. So I searched the Maven repositories for an artifact, and I found it. Version 2.1.7.
BUT: The artifact did not contain the native libs. There was no explanation how to handle this situation if part of the automated build is done via Maven, and another part (for the native libs) must be handled somehow different...

This is a mess. RXTX is widely used. So there should be an easy way to use it with Maven too.

Also the RXTX documentation on how to setup the system to use the RXTX lib + native lib is no longer "state of the art": The suggestion to add files to the JRE installation is in most scenarios not a good idea. For instance other programs might want to use a different version of the libs you put into the JRE folder ... So, there must be something new ...


I downloaded the java source of RXTX, together with the JNI binaries. I created a Maven3 project containing the source + the JNI binary libs. To overcome the "java.library.path" issue (which is not very well understood by many developers...), I added a "LibLoader": I replaced all "System.loadLibrary()" calls in RXTX source with the new "LibLoader.loadLibrary()" call. The new loader detects your operation system + JVM architecture (32bit/64bit), extracts the correct jni library for your platform to the OS' temp folder and loads this extracted file, instead of relying on a correct set "java.library.path" plus correctly installed JNI libs.

If there is no library for your OS and ARCH, the loader will fall back to "System.loadLibrary()" and you can go ahead with the old mechanism of "java.library.path".

Maven Repo for RXTX-Rebundled?

Just make your pom.xml look like this:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">



            <name>root1.de Releases Repository</name>


If you don't want to use Maven, click on Files in the navigation bar on this site ...

More documentation ...

You can find the source of the new loader class here: http://svn.root1.de/svn/rxtx-rebundled/trunk/src/main/java/de/root1/rxtxrebundled/LibLoader.java
The rest of RXTX-source is, except the loader-replacement, unchanged. So if you have general RXTX questions, please visit http://rxtx.qbang.org

What about updates??

There wasn't much updates in the past months/years from RXTX. The RXTX library is widely used and it's stability has been proven many times. I personally don't expect an update in the near future from RXTX team. But if so, I will of course update this "wrapper library" too.
Of course I informed the RXTX developers about this project and asked them to adapt the idea with the LibLoader. Until now, I did not receive any answer :-(


The project is, like RXTX itself, licensed under LGPL. So you're free to use it in any commercial or non-commercial, closed or open source project.