Sun Microsystems V2.0 manual With adderlib as your current directory, execute the command

Models: V2.0

1 54
Download 54 pages 11.11 Kb
Page 47
Image 47

Start by copying LibraryExtensionSampleCode to a working area. This contains two sub-directories: adderlib and addertest. adderlib contains the library. You should find a sub-directory containing the library Java source: you can add to or edit this as you see fit.

1. Build any new .jar files containing additions to the library

With adderlib as your current directory, execute the command

ant jar-app

to create a jar file containing the library extension. You can check the correct execution of this command by looking in your SDK installation, where you should now find adderlib_rt.jar in the lib directory. The name of the .jar file is controlled from the file build.properties in the root directory of the adderlib directory.

2. Rebuild any of the existing .jar files which you wish to modify

In this example, we don’t plan to modify the supplied library code, and so we skip this step. However, see the section Modifying the system library code for an explanation of what to do if you do wish to make such modifications.

3. Combine the various .jar files into a library suite

Identify the file .sunspot.properties in your user root folder. Add these two lines

spot.library.name=adderlib

spot.library.addin.jars=${sunspot.lib}/adderlib_rt.jar${path.separator}${sunspot.lib}/mul tihoplib_rt.jar${path.separator}${sunspot.lib}/transducerlib_rt.jar

The first line specifies the name of the library suite file, and should replace an existing line that defines the same property. This can be any legal filename you wish (the actual file will be created with a “.suite” suffix).

The second line specifies some of the .jar files will be combined to create a library jar. The three

files listed in .sunspot.properties are

multihoplib_rt.jar (the standard communications stack)

transducerlib_rt.jar (the standard library for the demo sensor board)

adderlib_rt.jar (the sample library extension we’re working with).

In fact, all libraries contain two further .jar files, which do not need to be specified in the

spot.library.addin.jars property:

spotlib_device.jar (core library classes that run on the SPOT device)

spotlib_common.jar (core library classes that run on both the SPOT device and in host applications. For example, the high level interface to radio communication).

Once you have modified .sunspot.properties, execute this command:

ant library

This should create a library suite named adderlib.suite in the arm sub-directory of your SDK installation. Because we have defined the properties that control the “ant library” command in

.sunspot.properties, this command can be executed from any folder that contains a valid

build.xml.

47

Page 47
Image 47
Sun Microsystems V2.0 manual With adderlib as your current directory, execute the command