Java Serial Communications Revisited

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: 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 shared object required for traditional serial communications.  The,, and 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:  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: 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:

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.


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.

Posted by Ivan Pozo on July 16, 2014 at 03:31 PM EDT #

Hi Ivan,

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

-- Jim C

Posted by Jim Connors on July 17, 2014 at 09:45 AM EDT #

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.

Posted by Myk on November 06, 2014 at 10:50 PM EST #

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

Posted by Mayur Patil on December 02, 2014 at 01:54 AM EST #

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.

Posted by Jim Connors on December 02, 2014 at 01:23 PM EST #

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..

Posted by Mayur Patil on December 10, 2014 at 12:14 AM EST #

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 which pointo to the javahidapi project:

Posted by Jim Connors on December 11, 2014 at 10:26 AM EST #

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

Posted by guest on December 24, 2014 at 08:52 AM EST #

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.

Posted by Jim Connors on December 26, 2014 at 09:36 AM EST #

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.

Posted by Jim Connors on December 26, 2014 at 09:44 AM EST #

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.

Posted by guest on January 14, 2015 at 07:42 PM EST #

Repository :
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.

Posted by guest on March 26, 2015 at 05:41 AM EDT #

Is there any licensed library other than SerialIO?

Posted by Deepak Ahuja on December 18, 2015 at 08:07 AM EST #


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

Posted by guest on January 12, 2016 at 01:48 PM EST #

Hello guest,

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


Posted by Jim Connors on January 19, 2016 at 01:49 PM EST #

Post a Comment:
  • HTML Syntax: NOT allowed

Jim Connors-Oracle


« July 2016