1
1
RXTX - Full Java CommAPI implementation
2
2
=======================================
4
The rxtx-1.5 package contains a full implementation of the Java CommAPI from
5
Sun. To use applications, written with the original CommAPI, with rxtx you have
6
to change references to javax.comm.* to gnu.io.*.
4
This package contains a full implementation of the Java CommAPI from Sun. To
5
use applications, written with the original CommAPI, with rxtx you have to
6
change references to javax.comm.* to gnu.io.*.
8
8
The rest of this file contains some useful information about problems with the
9
9
rxtx package found in the upstream INSTALL file. The unimportant sections are
17
B. Exception in thread "main" java.lang.UnsatisfiedLinkError: no Serial in
17
B. Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxSerial in
20
libSerial.so is located in the wrong directory. Here is an example
22
$ mv /usr/local/java/jre/lib/i386/libSerial* /usr/local/lib
24
Exception in thread "main" java.lang.UnsatisfiedLinkError: no Serial in
26
at java.lang.ClassLoader.loadLibrary(Compiled Code)
27
at java.lang.Runtime.loadLibrary0(Compiled Code)
28
at java.lang.System.loadLibrary(Compiled Code)
29
at gnu.io.NativePort.<clinit>(NativePort.java:32)
30
at gnu.io.RXTXPort.<init>(Compiled Code)
31
at gnu.io.RXTXCommDriver.getCommPort(Compiled Code)
32
at gnu.io.CommPortIdentifier.open(Compiled Code)
33
at SerialPortDisplay.openBBPort(Compiled Code)
34
at SerialPortDisplay.<init>(Compiled Code)
35
at BlackBox.addPort(Compiled Code)
36
at BlackBox.main(Compiled Code)
40
$ mv /usr/local/lib/libSerial.* /usr/local/java/jre/lib/i386/
20
librxtxSerial.so is located in the wrong directory. Here is an example
22
$ mv /usr/local/java/jre/lib/i386/librxtxSerial* /usr/local/lib
24
Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxSerial
26
at java.lang.ClassLoader.loadLibrary(Compiled Code)
27
at java.lang.Runtime.loadLibrary0(Compiled Code)
28
at java.lang.System.loadLibrary(Compiled Code)
29
at gnu.io.NativePort.<clinit>(NativePort.java:32)
30
at gnu.io.RXTXPort.<init>(Compiled Code)
31
at gnu.io.RXTXCommDriver.getCommPort(Compiled Code)
32
at gnu.io.CommPortIdentifier.open(Compiled Code)
33
at SerialPortDisplay.openBBPort(Compiled Code)
34
at SerialPortDisplay.<init>(Compiled Code)
35
at BlackBox.addPort(Compiled Code)
36
at BlackBox.main(Compiled Code)
40
Solution 1: move the file to a place that works
42
$ mv /usr/local/lib/librxtxSerial.* /usr/local/java/jre/lib/i386/
44
Solution 2: add the location of librxtxSerial to LD_LIBRARY_PATH
46
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/
48
Solution 3: pass the location in on the command line
50
$ java -Djava.library.path=/usr/local/lib/ ...
42
52
C. I Can Not Open the Port.
44
If you're not able to open the port (read the errors carefully) then you
45
may not have permission to use the device. Redhat Linux ships with the
46
following permissions:
50
Users need to be able to read and write with serial communication...
54
should fix the problem. Be sure to check the file CommAPI for common
57
Make sure that the user can create lock files.
54
If you're not able to open the port (read the errors carefully) then you
55
may not have permission to use the device. Redhat Linux ships with the
56
following permissions:
60
Users need to be able to read and write with serial communication...
64
should fix the problem. Be sure to check the file CommAPI for common
67
Make sure that the user can create lock files.
59
69
D. java.lang.NoClassDefFoundError: gnu/io/CommPort
61
RXTXcomm.jar is probably not in your classpath or not located in
64
for example, lets not include RXTXcomm.jar
66
export CLASSPATH=../java/lib/classes.zip
67
$ java BlackBoxException in thread "main"
68
java.lang.NoClassDefFoundError: gnu/io/CommPort
71
RXTXcomm.jar is probably not in your classpath or not located in
74
for example, lets not include RXTXcomm.jar
76
export CLASSPATH=../java/lib/classes.zip
77
$ java BlackBoxException in thread "main"
78
java.lang.NoClassDefFoundError: gnu/io/CommPort
329
339
Until you do, "setserial -ga /dev/ttyS0" will always tell you
330
340
the UART is unknown.
344
More info is needed on signing applets. This is an exchange from the rxtx mail-
349
prashantg10@yahoo.com asked:
353
I am trying to use applet on thin terminal which has
354
Linux base Kernel.For testing I am using Linux
355
machine.I have install all the required components.
356
e.g. JDK, RXTX. Everthing is fine. BlackBox runs ,even
357
my application runs. When It comes to applet,
358
everything is halts. It does not even show the listing
359
of ports. Is it because applet can't run under root
360
account or what might be the reasons. Can anybody tell
363
Son To <son@openbx.net> replied:
365
Java applets run withing the sandbox of the security manager.
366
Applets must be signed to access the com port, but for development
369
user_pref("signed.applets.codebase_principal_support", true);
371
in your prefs.js located in ~/.mozilla/default/XYYrandomDirName
373
I didn't use Java applet for my application. I used XUL and CSS for
374
the GUI development and used mozilla Javascript SOAP library to
375
communicate with apache Axis webservice backend which uses RXTX to
332
378
-------------------------------------------------------------------------------