Tradition says that the first application should be the canonical 'Hello
World' program. Since we assume that you are already familiar with
MIDP development, we're going to use a new introductory application
that allows us both to run our first application and to answer a question
that developers ask every time they get a new device: what JSRs are
supported on the device?
The first application that we run on a Symbian smartphone is a utility
to detect which APIs are supported. At the end of this section, not only
will you be able to run your first application, but you will also have an
extensible Java ME detection tool which is used in other chapters. We
call it the Java ME Detectors suite.
3.1.1 Implementing the Java ME Detectors Suite
To develop the application we need an SDK and an IDE. NetBeans and
Java ME SDK 3.0 are sufficient for creating your first MIDlet. That tells
you that Java ME development for Symbian OS can be done using the
standard Java ME tools and SDKs that you have always used. However,
there are many other tools for you to benefit from, and they are discussed
in Chapter 5.
Create a project named 'Java ME Detectors' in NetBeans. It will con-
tain three classes: JSRsDetectorMIDlet , JSRsView and ApiInfo
(source code and binaries can be downloaded from the website for this
topic, developer.symbian.com/javameonsymbianos ). The main function-
ality of the application is to receive as input the name of a JSR and a main
class from that JSR, and to detect if it is supported. The input can come
from the JAD, JAR manifest file, properties file, or the UI.
The Mobile Services Architecture (MSA) defines system properties for
each JSR that indicate whether the JSR is supported or not. For example,
wireless.messaging.version returns the WMA version supported
by the device. However, to make this utility portable for devices which are
not compliant withMSA, we detect the JSR by trying to load a sample class.
ApiInfo encapsulates the information that is read as input: the name
of the API and its main class, which indicates that the JSR is supported if
it can be dynamically loaded:
// Encapsulates an API's name and main class
public class ApiInfo
JSRsView contains the core application task, which is to detect the
list of APIs given as input. When the user presses Detect, an array of
ApiInfo is requested from the MIDlet and, for each ApiInfo in the