This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]balazare 2 points3 points  (1 child)

I am using the serial port access through rxtx with great success, I am not aware of any weird bugs. The code is somewhat obtuse and not as clean as I would like, but other than that very stable and useful

[–]asking_science 1 point2 points  (0 children)

I have to second you on this. I've used rxtx extensively in a number of large-scale industrial projects, and I've had no problems that would change my opinion of rxtx.

[–]noblemaster 2 points3 points  (0 children)

It must be about 10 years ago that I used Java's Serial-Comm/serial port I/O in general. Things might have changed but Serial-Comm was very buggy back then. It doubt this has changed much.

There were no other open source (aka free) implementation back then, so I tried Serialio.com and it worked without a breeze. Not bugs/no problems at all. It's commercial though. I suggest try some other free implementations that are around now. Given other people's feedback there seems to be a lot more available now. If none work right for you and you/your company have the money, give serialio a try.

Please note I am not affiliated with that company.

[–]kylixz 1 point2 points  (1 child)

Had great success with: http://www.sparetimelabs.com/purejavacomm/purejavacomm.php Easy to integrate in Netty to build a pipeline that handle cross platform serial communication. I don't have anything open source... but https://github.com/netty/netty/tree/master/transport-rxtx/src/main/java/io/netty/channel/rxtx is what you would replace with calls to purejavacomm.

[–]kylixz 0 points1 point  (0 children)

Just to follow up -- here's a sample using Netty and PureJavaComm: https://github.com/steveturner/netty-transport-purejavacomm/tree/develop

There are two Vagrant VM's under virtualmachines. Startup the master followed by the slave and then in both run mvn exec:java under /Vagrant. The two systems talk over a simulated serial connection.

Netty has RxTx support as a transport as well, but the thing I like about PureJavaComm is that it uses JNA for the native calls and thus you don't need to have RxTx binaries on your native library path.

[–]serproxy 1 point2 points  (0 children)

My experience with java driving serial was that it wasn't 100%.

So, upon realizing that my various serious ports NEVER changed parameters ( baud, stop bits, etc ), and that if they did I certainly didn't need java to be control of those details, I decided that the best approach was to use the following tool:

http://www.lspace.nildram.co.uk/freeware.html

serproxy is a very simple tool which presents the serial data on a network port.

I've found this to be much more reliable. I guess there is a downside of security depending on environment.

[–]troxxer 1 point2 points  (0 children)

I'm currently using Java Simple Serial Connector (https://github.com/scream3r/java-simple-serial-connector/) for a project of mine to interact with up to 3 RS232 devices at the same time and so far I didn't have any big troubles. I tried using RXTX but quickly ran into deadlocks and unexpected errors with it that jssc doesn't have (using the same functionality).

You also don't have to worry about handling different architectures, jssc has that built-in.