Topics and trends related to the Java ecosystem with occasional random rants.

  • Sun
    June 20, 2014

Java Serial Communications Revisited

James Connors
Principal Solutions Consultant

Last touched upon in this article dated August 2011, it's high time to revisit the state of Java serial port communications options for the following reasons:

  • As the hype around Internet of Things continues to ratchet up, serial communications are a requirement for a certain class of IoT sensors and devices.
  • RxTx, the platform with arguably the most history, cannot be built with the recently released Java 8 JDK without some modifications.
  • For some time now the website hosting the RxTx project: http://rxtx.qbang.org/wiki/index.php/Main_Page has not been available.
  • Building support for additional specifications like RS-485 and parallel is available in RxTx but was never addressed in the previous serial communications article.
  • An alternative framework called jSSC is gaining in popularity and is worth further discussion.
  • Work in the OpenJDK Device I/O Project is progressing. Among the goals of this project is support for serial communications.


In my customer experiences, RxTx, despite its age, still gets mentioned most when considering serial communications with Java.  For whatever reasons, the RxTx project has gone off line, and access to the project source code is not readily available.  Fortunately, we have a copy, and have made a few enhancements such that:

  • The source can now be compiled with a JDK versions 6, 7 and 8.
  • The original article discussed only enough modifications to build the  librxtxSerial.so shared object required for traditional serial communications.  The librxtxParallel.so, librxtxRaw.so, librxtxI2C.so and librxtxRS485.so shared objects could not be built.  With some very slight modifications, these can successfully be built too.  I make absolutely no promises as to their usefulness, but they do compile. :)

The source code is based upon the original 2.1-7r2 version and in this instance is now called 2.1.7r2-Java8.  You can download the source here.  If you want to get a feel for the changes made, take a look at this file:  JAVA8_MODS.txt which can be found in the main directory of the source code.  To build RxTx on your native platform:

   $ tar xvf 2.1.7r2-Java8.tar.gz
$ cd 2.1.7r2-Java8/
$ ./configure
$ make


The Java Simple Serial Connector, or jSSC for short, is another open source project that can be found here: http://code.google.com/p/java-simple-serial-connector/.  It is available for a host of processor/OS combinations and, in addition to source availability, comes bundled in binary form too.  Here's a list of supported platforms for its current 2.6.0 release:

Win32 Win64 Linux_x86 Linux_x86_64 Linux_ARM Solaris_x86 Solaris_x86_64 MacOSX_x86 MacOSX_x86_64 MacOSX_PPC MacOSX_PPC64

Like RxTx, it contains a native component but is packaged in a nice transparent fashion.  The one potential challenge here may be in trying to figure out how to support a new platform that isn't on this list.  I didn't have a whole lot of success finding out how to build the binary, and admittedly didn't spend an inordinate amount of time trying to figure it out either.  Nonetheless, this project is gaining in popularity and has a dedicated individual supporting the software.

OpenJDK Device I/O

Finally, a project is underway to treat serial communication and device I/O in general as a first class citizen for the Java SE standard. The wiki can be found here: https://wiki.openjdk.java.net/display/dio/Main. It is based on the work done to provide device I/O to the Java ME 8 platform.  Further solidifying the universality theme of Java 8, the ultimate goal would be to have a consistent device I/O API across both Java SE and Java ME.  If you want to further understand what those APIs look like you can view them here: http://docs.oracle.com/javame/8.0/api/dio/api/index.html.

In conclusion, support for serial communications in Java SE is -- albeit slowly -- progressing.  There are multiple open source projects and commercial alternatives too.  Ideally, it will be great to see a formal API supported by the Java SE Standard.

Join the discussion

Comments ( 16 )
  • Ivan Pozo Wednesday, July 16, 2014

    Hello, i have using the original library in my implementations, but i lost this files. I tried to use your library but i got an error on my platform (CentOs 6.5). It is possible to give me the original files (qbang's rxtx). ?. Thanks and regards.

  • Jim Connors Thursday, July 17, 2014

    Hi Ivan,

    I only have the original source for rxtx-2.1-7r2 and have placed it here:


    -- Jim C

  • Myk Friday, November 7, 2014

    Another cross-platform library we use is SerialIO's SerialPort library. It is effective and robust but it has several problems. (1) it is only supported for 30-90 days after purchase, (2) most support enquiries receive the grumpy response "modify the source and recompile it yourself", (3) it must be re-purchased every time there is a new platform (e.g. Windows 8, Windows 8.1), (4) it is expensive to re-buy each time especially with source included and (4) it doesn't include any Linux ARM binaries at all (eg. for Raspberry PI) - fiddling about with the source to achieve this is not something we're willing or able to do.

  • Mayur Patil Tuesday, December 2, 2014

    sir i am communicate plc to java. those library use can communicate to plc machine. pls sir help me..then suggest me..

  • Jim Connors Tuesday, December 2, 2014

    If you wish to comminucate via Java with a PLC and that PLC supports serial commuinication, then yes you should be able to use either the RxTx or jSSC libraries.

  • Mayur Patil Wednesday, December 10, 2014

    sir i have communicate to messung plc. but those plc not available Ethernet port only rs232/485 port available. my project to monitoring the plc to use java lang. i have use converter rs232 to usb . those converter use possible connecting the plc to laptop. then can possible use converter monitor to plc to java lang. pls suggest me..

  • Jim Connors Thursday, December 11, 2014

    Hi Mayur,

    I recently blooged about using javahidapi as a means to communicate, via Java, to a USB device. In this instance the device was a USB temperature sensor, but javahidapi should hopefully be flexible enough for serial port communcation too.

    Check out https://blogs.oracle.com/jtc/entry/simplifying_usb_access_for_java which pointo to the javahidapi project: http://code.google.com/p/javahidapi/

  • guest Wednesday, December 24, 2014

    Any experience/thoughts about serilio.com's SerialPort (product) for Java?

  • Jim Connors Friday, December 26, 2014

    Heard about them, but never used it. I have no reason to believe that it isn't a very effective platform, Just looking at pricing, a 1000-seat license costs $9995 USD which amounts to a $10 per-seat cost. On embedded systems, the per-seat cost of deploying a JRE is likely to be less. Seems without discounting to be a pricy addition.

  • Jim Connors Friday, December 26, 2014

    My bad. The 100 user per-seat cost (list price) is $995, which is a lot more reasonable. What I do find annoying though is that they charge for development seats.

  • guest Thursday, January 15, 2015

    Just compiled your newest version of rxtx, deployed on an Atom processor (i386) Shuttle computer running Arch Linux. Java version 1.7.0_71. Works fine. Thanks for doing this.

  • guest Thursday, March 26, 2015

    Repository : https://github.com/RishiGupta12/serial-communication-manager

    Wiki : http://www.embeddedunveiled.com/scm-wiki

    The 'serial communication manager (scm)' is a java library designed and developed to exchange data on serial port. It supports RS-232 control signals handshaking, monitoring and has been ported to Linux, MAC, Solaris and Windows operating system. It is consistent, scalable, testable, efficient, reliable and portable.

  • Deepak Ahuja Friday, December 18, 2015

    Is there any licensed library other than SerialIO?



  • guest Tuesday, January 12, 2016


    I have a question, I am trying to use a share library on Linux Unbuntu. In java when I call

    System.loadLibrary( “libRS2328Bit”);

    I get an exception java.langauge.UnsatisfiedLinkError: no libRS2328Bit in java.library.path

    I am running in netbeans 8.1 and in the properties of the java project I use –Djava.library.path=path to file

    I also in the terminal where netbeans is running I set the LD_LIBRARY_PATH to the same place.

    I know at one time this worked in java 1.42 a number of years ago did something change in java 1.7


  • Jim Connors Tuesday, January 19, 2016

    Hello guest,

    Assuming the shared library in your java.library.path is named libRS2328Bit.so, have you tried a System.LoadLibrary() call without the 'lib' prefix?


  • guest Monday, September 19, 2016

    There is also my RXTX / JavaComm compatible pure Java library that by now can be considered stable and fast, runs on Mac OS, Linux (even Raspberry PI) and Windows with no C/native code insight or to compile.

    Original release announcement here:


    and the latest code in here:


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.