17

Is there a java library or framework (other than the javax.comm provided by Sun) that is easy to use when accessing serial and parallel ports ( especially RS-232 ). I need something free that will work both on Windows and Linux.

Azder
  • 4,698
  • 7
  • 37
  • 57
  • Similar question: http://stackoverflow.com/questions/264469/java-rs-232-communication-on-windows – sk. Apr 14 '09 at 14:17

4 Answers4

12

The most common framework used for this is rxtx.

joelittlejohn
  • 11,665
  • 2
  • 41
  • 54
andri
  • 11,171
  • 2
  • 38
  • 49
11

As andri pointed out RXTX is pretty much your best choice. There is an article on getting started with RXTX on Windows here (relating to RXTX 2.1).

joelittlejohn
  • 11,665
  • 2
  • 41
  • 54
Pierre-Luc Simard
  • 2,723
  • 19
  • 27
5

If free isn't necessary -- remember, your time isn't free -- then Serial IO SerialPort might be useful. It's the only thing I found that works as-is on all of the following:

  • 32/64-bit Windows
  • 64-bit Solaris (didn't test 32-bit)
  • 32 bit Linux (didn't test 64-bit)
  • Mac OS X

You do get source with the product, albeit with some weird and annoying build practices.

FWIW, I'm just a contented user, not affiliated with the company.

Chris Winters
  • 1,001
  • 1
  • 6
  • 5
  • 2
    I have used it also with multiple versions of Windows with no problems - OTOH, serial libraries from Sun, IBM and RxTx were all unstable and crashed at random intervals. – Lawrence Dol Apr 14 '09 at 16:27
0

rxtx as the other posters have said. I've been using it and it works nicely. There is a problem if using nonstandard highspeed baudrates (multiples of 115200 e.g. 230400, 921600 are OK, but 1MB is not even if the hardware & underlying OS supports it), I've been told this will be corrected in rxtx 2.2.

Jason S
  • 184,598
  • 164
  • 608
  • 970
  • Hi, would you still recommend rxtx? Since it's still at 2.1 and not having fixed the bug you mentioned 6 years ago. – clankill3r Mar 13 '15 at 15:40
  • Not really; there's Trent and maybe a few other contributors, and it still has the same problems. I use purejavacomm now; have been using it with 4.3Mbaud with an FTDI chip with high success. – Jason S Mar 13 '15 at 16:49