Sun Microsystems V2.0 Welding System User Manual


 
46
Expand each of the first four of these, then select and edit the “Source attachment”. Point this to the
relevant source jar as follows:
transducerlib_rt.jar SDK_INSTALL_DIRECTORY/src/transducerlib_source.jar
multihoplib_rt.jar SDK_INSTALL_DIRECTORY/src/multihoplib_source.jar
spotlib_common.jar SDK_INSTALL_DIRECTORY/src/spotlib_source.jar
spotlib_host.jar SDK_INSTALL_DIRECTORY/src/spotlib_source.jar
You may need to create a new Eclipse classpath variable to do this. After this, you should see
source for the Sun SPOT library code as you debug.
Advanced topics
Using library suites
Introduction
The earlier section Deploying and running a sample application shows the process of building user
application code into a suite file, deploying that suite file to a Sun SPOT, and executing the
application. In fact, each Sun SPOT actually contains three linked suite files:
a bootstrap suite: which contains the base J2ME and CLDC libraries, and other system-level
Java classes
a library suite: which contains Sun SPOT-specific library code supplied in this release
an application suite: which contains application code.
For simple application development, the existence of the bootstrap and library suites can be ignored.
However, if you develop a substantial body of code that, over time, becomes stable and slow-
changing, you can add this code to the library suite. This makes application suites smaller, and
hence quicker to build and quicker to deploy. The disadvantage of this is that when the code within
the library suite does change, two suites must be re-built and re-deployed, which takes longer.
Alternatively, you may wish to modify the supplied code in the library suite, to experiment with
alternatives to system components. In this instance, you might even move code from the library
suite to the application suite.
The library suite is constructed from a number of
.jar
files. The process for building a library suite
is as follows:
1. Build any new
.jar
files containing extensions to the library.
2. Rebuild any of the existing
.jar
files which you wish to modify
3. Combine the various
.jar
files into a library suite
4. Deploy the new library suite to your Sun SPOTs
5. Build and deploy applications that use the library suite as usual.
The next section works through an example of adding user code into the library suite.
Adding user code to the library suite
Locate the folder
LibraryExtensionSampleCode
in the
CodeSamples
directory. This contains a tiny
library extension consisting of a single class
adder.Adder
, that has a single static method
add(int x,
int y)
that adds two numbers together. In this example, we will rebuild the library suite to include
this extension, install it to a Sun SPOT, and then deploy an application that uses our extension
without including the
Adder
class within the application.