Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cross Platform Serial port communication in Java?

I'm trying to do serial communication with Java. It's hard to believe that there's not some nice, out of the box solution like there is in C#.

I'm looking around the SerialIO website, but it's not clear that there's a free .jar I can download to get the functionality I need. (Is it just for sale? I can't find a link for a .jar download of any sort.)

All I need is read/write over a serial port, and setting a baud rate. Nothing fancier than that.

Edit: I require that it works on 64 bit Windows and Mac OS X. The Java Communications API only has implementations for Linux.

like image 591
Nick Heiner Avatar asked Apr 14 '11 20:04

Nick Heiner


People also ask

What is serial communication in Java?

What is jSerialComm? jSerialComm is a Java library designed to provide a platform-independent way to access standard serial ports without requiring external libraries, native code, or any other tools.

Which port is used for serial communication?

The serial port standard is RS-232. This standard is used for transmitting serial communication between devices, which are usually called data communications equipment (DCE) and data terminal equipment (DTE). The serial port uses a nine-pin (DE-9) connector or a 25-pin (DB-25) connector.

How does serial port communication work?

Serial ports lower cable costs and make cables smaller. Before each byte of data, a serial port sends a start bit, which is a single bit with a value of 0. After each byte of data, it sends a stop bit to signal that the byte is complete. It may also send a parity bit.


2 Answers

Maybe RxTx java library is what you are looking for http://rxtx.qbang.org/wiki/index.php/Main_Page

like image 167
Daniel Voina Avatar answered Oct 09 '22 05:10

Daniel Voina


SerialIO is a commercial product.

Take a look at Java simple serial connector

jSSC-0.9.0 Released and available for download. jSSC (Java Simple Serial Connector) - library for work with serial port from Java. jSSC >support Win32 (Win98-Win7), Win64, Linux(x86, x86-64), Solaris(x86, x86-64), Mac OS X 10.5 >and higher(x86, x86-64, PPC, PPC64).

It is licensed under LGPL. We have been succesfully using it in production for over half a year now. It has shown to be stable, as opposed to RXTXcomm.

like image 45
linski Avatar answered Oct 09 '22 04:10

linski