Excluding files from the compilation

To exclude files or folders matching a specific pattern from the java compilation, set the ant property spot.javac.exclude.src, either on the command line with –D or in the build.properties file of the project. The value of the property should be specified using standard ant wildcarding.

For example, to exclude all source files in all “unittests” folders, use:

spot.javac.exclude.src=**/unittests/*

Manifest and resources

The file MANIFEST.MF in the resources/META-INFdirectory contains information used by the Squawk VM1 to run the application. In particular it contains the name of the initial class. It can also contain user-defined properties that are available to the application at run time.

A typical manifest might contain:

MIDlet-Name: Air Text demo

MIDlet-Version: 1.0.0

MIDlet-Vendor: Sun Microsystems Inc

MIDlet-1: AirText, , org.sunspotworld.demo.AirTextDemo

MicroEdition-Profile: IMP-1.0

MicroEdition-Configuration: CLDC-1.1

SomeProperty: some value

The syntax of each line is:

<property-name>:<space><property-value>

The most important line here is the one with the property name MIDlet-1”. This line has as its value a string containing three comma-separated arguments. The first argument is a string that provides a name for the application and the third defines the name of the application's main class. This class must be a subclass of javax.microedition.midlet.MIDlet. The second argument defines an icon to be associated with the MIDlet, which is currently not used.

The application can access properties using:

myMidlet.getAppProperty("SomeProperty");

All files within the resources directory are available to the application at runtime. To access a resource file:

InputStream is = getClass().getResourceAsStream("/res1.txt");

This accesses the file named “res1.txt” that resides at the top level with the resources directory.

Other user properties

For properties that are not specific to the application you should instead use either

persistent System properties (see section Persistent properties) for device-specific properties

properties in the library manifest (see section Library manifest properties

Each library extension must contain a file named

1The Squawk VM is the Java virtual machine that runs on the Sun SPOT. For more details, go to http://research.sun.com/projects/squawk/.

13

Page 13
Image 13
Sun Microsystems V2.0 manual Manifest and resources, Excluding files from the compilation, Other user properties