![](/images/new-backgrounds/1311413/31141311x1.webp)
Building and deploying Sun SPOT applications
Deploying and running a sample application
The normal process for creating and running an application (assuming you are working from the command line rather than an IDE) is:
•Create a directory to hold your application.
•Write your Java code.
•Use the supplied ant script to compile the Java and bind the resulting class files into a deployable unit.
•Use the ant script to deploy and run your application.
In this section we will describe how to build and run a very simple application supplied with the SDK. Each step is described in detail below.
1.The directory Demos/CodeSamples/SunSpotApplicationTemplate contains a very simple Sun
SPOT application that can be used as a template to write your own.
The complete contents of the template directory should be copied to the directory in which you wish to do your work, which we call the root directory of the application. You can use any directory as the root of an application. In the examples below we have used the directory
C:\MyApplication.
All application root directories have the same layout. The root directory contains two files - build.xml and build.properties – that control the ant script used to build and run applications. The root directory also contains three
2.Compile the template example and create a jar that contains it by using the “ant
C:\MyApplication>ant
Buildfile: build.xml
init:
6