Java is multi-platform .... Yay !
Java runs on all sorts of operating systems, anything which can run a JVM ... Yay !
Mac 32/64, Windows 32/64, Linux 32/64, Arm 32, .. write code once, and it runs on all platforms ... Yay !
But in some cases, we need to talk to the hardware directly ... Uh oh...
This means someone has to write a C program which works as a bridge between Java & the hardware .. Uh oh
C programs are not binary compatible .... Grrr
C source programs are often not compatible on different platforms .... Grrr
This makes Java talking over a serial line robustly & consistently in a standardized way very difficult ... Grrr
There is a project called RXTX from qbang which is old (very old in software years) - which tries to make sending data over a serial line from Java easy .... Yay !
But the code is so old, fragile, and full of holes that there are issues on different platforms.. Linux serial ports never close for instance, and there are race conditions and deadlocks ... Grrr.
Qbang / RXTX - seem basically dead as far as development ... Grrr
So, now I'm trying to get another project called JSSC to work ... Yay..
But, unfortunately, I'm getting some weird results on Windows 7 64 bit .. Grrr
The trace shows output from a Arduino Mega card - "occasionally" - every other data read comes back as 1024 :P ... Grrr
Was hoping JSSC was going to be a magic bullet ... doesn't look like it ... Grrr
Hmmm... just thought, this might be because JSSC is not ready when I read the data - the "data ready" notification is slightly different in JSSC versus RXTX... I don't want to spend much more time (at this time) on this - fortunately, I've created a SerialDevice abstraction which interfaces with JSSC or RXTX - and allows me to switch them out easily.
Back to RXTX for a while and I'll look at the closing issue a little more closely... then, put it on the back burner for a while...