Page 156 - Hacking Roomba
P. 156
Chapter 7 — Making RoombaView 137
Listing 7-2: Processing Directory Structure for Libraries
Processing/
faq/
reference/
lib/
libraries/
serial/
net/
opengl/
roombacomm/
library/
export.txt
roombacomm.jar
RXTXComm.jar
librxtxSerial.jnilib
librxtxSerial.so
rxtxSerial.dll
The export.txt file contains a list of which files in the library are needed. For RoombaComm it
looks like:
application.macosx = roombacomm.jar, RXTXcomm.jar,
librxtxSerial.jnilib
application.linux = roombacomm.jar, RXTXcomm.jar, librxtxSerial.so
application.windows = roombacomm.jar, RXTXcomm.jar, rxtxSerial.dll
When Processing processes export.txt it recognizes which files are JAR files and which are
shared libraries and loads them appropriately. No more setting classpaths and Java environment
variables. Notice that export.txt contains separate entries for each OS. This is needed only
because RXTX needs platform-specific code to access the serial ports. If RoombaComm didn’t
need platform-specific code, then a single application line would be sufficient.
The RoombaComm distribution contains a script called build-processing-library.sh
that builds a roombacomm-processing.zip file containing everything needed to replicate
the directory structure of Listing 7-2 including all the necessary files.
Installing a Processing Library
When roombacomm-processing.zip is created (or downloaded off the Net), it needs to
be installed in Processing. Assuming both roombacomm-processing.zip and Processing
are in the same directory, installing the library through the command line is done with these
commands:
% cp roombacomm-processing.zip “Processing 0118/libraries”
% cd “Processing 0115/libraries”
% unzip roombacomm-processing.zip