[Rxtx] Baud rate problem

Mike Markowski mike.ab3ap at gmail.com
Sat Apr 21 11:42:16 MDT 2012


I'm stumped by an odd problem that seems related to baud rate, and 
wonder if anyone can offer some insight.  I have a section of code 
(below) that works fine compiled with JDK 1.6 when the baud rate is 
chosen as 9600 but enters the 'catch' block when choosing 38400.  This 
has nothing to do with using the device, but simply setting up the 
serial port.

Now here's the weird part.  If I recompile the code using java 1.7 
rather than 1.6 - it now works locally but not via Web Start, when I get 
the same error!

Thanks for any advice,
Mike

Here is some info:

PC: Linux ab3ap 3.3.2-gentoo #1 SMP Tue Apr 17 21:18:12 EDT 2012 i686 
Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz GenuineIntel GNU/Linux

mm at ab3ap ~ $ java -version
java version "1.7.0_02"
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot(TM) Server VM (build 22.0-b10, mixed mode)

and

mm at ab3ap ~ $ /opt/sun-jdk-1.6.0.31/jre/bin/java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) Server VM (build 20.6-b01, mixed mode)

Using with

rxtx-2.1-7-bins-r2.2-2

Code snippet.

         try {
                 System.out.println("ready");
                 serialPort.setSerialPortParams(
                         38400,
                         SerialPort.DATABITS_8,
                         SerialPort.STOPBITS_1,
                         SerialPort.PARITY_NONE);
                 System.out.println("here");
                 serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);

         } catch (UnsupportedCommOperationException e) {
             System.out.println("Couldn't open serial port!");
             return false;
         }

Running under JDK 1.7:

Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
RXTX Warning:  Removing stale lock file. /var/lock/LCK..ttyUSB0
ready
here
Experimental:  JNI_OnLoad called.

Running under JDK 1.6:

Native lib Version = RXTX-2.2pre2
Java lib Version   = RXTX-2.1-7
WARNING:  RXTX Version mismatch
     Jar version = RXTX-2.1-7
     native lib Version = RXTX-2.2pre2
RXTX Warning:  Removing stale lock file. /var/lock/LCK..ttyUSB0
ready
Couldn't open serial port!




More information about the Rxtx mailing list