Active1 year, 2 months ago
Dec 29, 2017 In this tutorial, I demonstrate how to build up a serial connection between a Java Application and an Arduino Uno. The tutorial is divided into two parts: In the first part, it is explained how to send text (digits) from a Java Application to an Arduino. JSSC (Java Simple Serial Connector) should also be considered There is also another library called jSerialComm that includes all its platform specific files in its jar, this makes it truly portable as there is no installation necessary. Getting started. Learn the basics of serial communication and programming.
Serial interfacing requires a standardized API with platform-specific implementations, which is difficult for Java. Unfortunately, Sun doesn't pay much attention to serial communication in Java. Sun has defined a serial communication API, called JavaComm, but an implementation of the API is not part of the Java standard edition. Most projects that deal with hardware and devices, needs to communicate with them using the COM port of the PC or Server. For example if there is a modem that is connected to a server via its COM port and the Java program has to read the output of the modem then the Java program has to read the COM port for any incoming data.
As a Java serial port communication API, currently I am using RXTX API. But with that API, it seems have some issues (with serial port communication) such as get delay to bind with COM port, lots some characters on device output received etc. Is there any better API for this?
With many articles I have seen Java haven't good support for Serial port communication. In that case for better performance, whether I can implement this serial port communication with C++ or C# and integrate with my Java application? Thanks.
Channa
ChannaChanna1,7711111 gold badges4747 silver badges8484 bronze badges
3 Answers
You can take a look at https://blogs.oracle.com/jtc/entry/java_serial_communications_revisitedwhere they analize the status of java serial communication.
![Communication Communication](/uploads/1/2/6/5/126588283/916983295.png)
They talk about jSSChttps://code.google.com/p/java-simple-serial-connector/and Device I/O Project http://openjdk.java.net/projects/dio/ , and also RXTX
Pablo Gallego FalcónPablo Gallego Falcón
If you are using Windows, you can take a look at https://github.com/thibautd/JSerial. Please note that I'm the author of the library, but I created it because no one fit my needs (for example it's hard to re-compile the native part of jSSC).
JSerial is MIT-licensed (you can use it in closed-source applications) and delivered with a full Visual Studio project if you need to modify the native part.
Hope it may be useful :-)
Thibaut D.Thibaut D.98633 gold badges1212 silver badges2727 bronze badges
I had a pretty nice experience with JSerialComm library. I've used this library on Linux and Windows 7 operating systems successfully. But I am not sure about windows 10. Also developers say that it works on OS X and Android. Besides said above, with this library you don't need to install any native library, it already there.
Andrew ArcherAndrew Archer