views:

876

answers:

5

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.

+7  A: 

The most common framework used for this is rxtx.

andri
+4  A: 

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

Pierre-Luc Simard
A: 

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
+1  A: 

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