U.S. GovernmentRights -Commercial software. Government usersare subjectto theSun Microsystems, Inc. standardlicense
agreement andapplicable provisions of theFARand itssupplements.
This distributionmay includematerials developedby thirdparties.
Sun, SunMicrosystems, theSun logo, Java, J2ME and the Java Coffee Cup logoare trademarksor registered trademarks ofSun
Microsystems, Inc.in theU.S. andother countries.The Adobelogo andthe PostScriptlogo are trademarks orregistered trademarks
of AdobeSystems, Incorporated.
Products covered by andinformation containedin thisservice manualare controlled byU.S. ExportControl laws and may be subject
to theexport orimport lawsin othercountries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end
users, whetherdirect orindirect, are strictly prohibited. Exportor reexport to countries subject to U.S. embargoor toentities
identified onU.S. exportexclusion lists,including, butnot limitedto, thedenied personsand speciallydesignated nationalslists is
strictly prohibited.
DOCUMENTATION IS PROVIDED "AS IS" AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE
LEGALLY INVALID.
Cette distributionpeut comprendre des composantsdéveloppés pardes tiercesparties.
Sun, SunMicrosystems, lelogoSun, Java, J2ME et lelogo JavaCoffee Cup sont des marques de fabrique ou des marques déposées
de SunMicrosystems, Inc.aux Etats-Uniset dansd'autres pays.Le logo Adobe. et le logo PostScript sont des marques de fabrique ou
des marquesdéposées deAdobe Systems,Incorporated.
Les produitsqui fontl'objet dece manueld'entretien et les informations qu'il contient sont regis par la legislation americaine en
matiere decontrole des exportations et peuvent etre soumis au droitd'autres pays dans le domaine des exportations et importations.
Les utilisationsfinales, ouutilisateurs finaux,pour desarmes nucleaires,des missiles,des armesbiologiques etchimiques oudu
nucleaire maritime,directement ou indirectement, sont strictement interdites. Lesexportations oureexportations vers des pays sous
embargo desEtats-Unis, ouvers desentites figurantsur leslistes d'exclusiond'exportation americaines,y compris,mais demaniere
non exclusive,la listede personnesqui fontobjet d'unordre de ne pas participer, d'une facondirecte ou indirecte, aux exportations
des produitsou desservices quisont regi par lalegislation americaineen matierede controle des exportationset laliste de
ressortissants specifiquementdesignes, sontrigoureusement interdites.
LA DOCUMENTATION EST FOURNIE "EN L'ETAT" ET TOUTES AUTRES CONDITIONS, DECLARATIONSET GARANTIES
EXPRESSES OUTACITESSONT FORMELLEMENTEXCLUES, DANSLA MESUREAUTORISEE PAR LA LOI APPLICABLE, Y
COMPRIS NOTAMMENT TOUTE GARANTIE IMPLICITE RELATIVEA LAQUALITE MARCHANDE,A L'APTITUDEA UNE
UTILISATIONPARTICULIERE OU A L'ABSENCE DE CONTREFACON.
Please
Recycle
Contents
Prefaceix
1. Introduction1
1.1Quick Start1
1.2The Tools in the Toolkit2
1.3Toolkit Features3
1.4Supported Technology3
2. Developing MIDlet Suites5
2.1About Projects5
2.2The Simple Development Cycle7
2.2.1Edit Source Code7
2.2.2Build8
2.2.3Run9
2.3The Full Development Cycle11
2.3.1Package11
2.3.2Install12
2.3.3Run14
2.4Using an Obfuscator15
2.5Using a Debugger17
2.6Deploying Applications on a Web Server17
3. Working With Projects19
Contentsiii
3.1Selecting APIs19
3.2Changing MIDlet Suite Attributes21
3.3Manipulating MIDlets23
3.4Using the Push Registry24
3.5Project Directory Structure25
3.6Using Third-Party Libraries25
3.6.1Third-Party Libraries for One Project26
3.6.2Third-Party Libraries for All Projects26
3.7Configuring KToolbar26
3.7.1Setting the Application Directory27
3.7.2Setting the javac Encoding Property27
3.7.3Working with Revision Control Systems27
4. Using the Emulator29
4.1Emulator Skins29
4.2Using the Emulator30
4.3Setting Emulator Preferences32
4.3.1Network Proxies32
4.3.2Heap Size33
4.3.3Storage and Cleaning33
4.3.4Adjusting Emulator Performance34
4.4Pausing and Resuming35
4.5Running the Emulator Solo36
4.6Using Third Party Emulators36
5. Monitoring Applications39
5.1Using the Profiler39
5.1.1The Call Graph41
5.1.2Execution Time and Number of Calls41
5.1.3Saving and Loading Profiler Information41
5.2Using the Memory Monitor42
5.2.1Saving and Loading Memory Monitor Information44
5.3Using the Network Monitor44
ivJ2ME Wireless Toolkit User’s Guide • October 2004
5.3.1Filtering Messages45
5.3.2Sorting Messages46
5.3.3Saving and Loading Network Monitor Information46
5.3.4Clearing the Message Tree47
6. Security and MIDlet Signing49
6.1Permissions49
6.2Protection Domains50
6.3Signing a MIDlet Suite51
6.4Managing Keys52
6.4.1Creating a New Key Pair52
6.4.2Getting Real Keys53
6.4.3Importing an Existing Key Pair54
6.4.4Removing a Key Pair54
6.5Managing Certificates54
6.5.1Importing Certificates55
6.5.2Removing Certificates56
7. Using the Wireless Messaging API57
7.1Setting Emulator Phone Numbers57
7.2Simulating an Unreliable Network58
7.3Sending Messages With the WMA Console59
7.3.1Sending a Text SMS Message59
7.3.2Sending a Binary SMS Message60
7.3.3Sending Text or Binary CBS Messages61
7.3.4Sending MMS Messages62
7.4Receiving Messages in the WMA Console63
7.5Using the Network Monitor with WMA64
8. Using the Mobile Media API65
8.1Supported Formats and Protocols65
8.2Using MediaControlSkin66
8.3Media Capture66
Contentsv
8.4Well-Behaved MIDlets66
9. Working With Mobile 3D Graphics67
9.1JSR 184 Overview67
9.2Immediate Mode67
9.3Retained Mode68
9.4Trading Quality for Speed68
9.5Creating Mobile 3D Graphics Content69
10. Using the PIM and FileConnection APIs71
10.1The FileConnection API71
10.2The PIM API72
11. Using the Bluetooth and OBEX APIs73
11.1Bluetooth Simulation Environment73
11.2OBEX Over Infrared73
11.3Setting OBEX and Bluetooth Preferences74
11.3.1OBEX Preferences74
11.3.2Bluetooth Discovery Timeout75
11.3.3Bluetooth System Properties75
11.3.4Bluetooth BCC Properties75
12. Using Web Services77
A. Application Demonstrations79
A.1Overview79
A.2General Instructions81
A.3BluetoothDemo82
A.4Demo3D83
A.4.1Life3D83
A.4.2PogoRoo84
A.4.3retainedmode85
A.5JSR172Demo86
A.6mmademo86
viJ2ME Wireless Toolkit User’s Guide • October 2004
A.6.1Simple Tones87
A.6.2Simple Player87
A.6.3PausingAudioTest89
A.6.4Video89
A.6.5Attributes for mmademo90
A.7ObexDemo90
A.8PDAPDemo92
A.8.1Browsing Files92
A.8.2The PIM API94
A.9WMADemo97
B. Command Line Reference103
B.1Prerequisites103
B.2The Development Cycle103
B.2.1Build103
B.2.2Package104
B.2.3Run106
B.2.4Debugging107
B.3Launching Toolkit GUI Components108
B.4Setting Emulator Preferences108
B.5Using Security Features110
B.5.1Changing the Emulator’s Default Protection Domain110
B.5.2Signing MIDlet Suites111
B.5.3Managing Certificates112
B.6Using the Stub Generator113
B.6.1Options113
B.6.1.1Example114
C. Internationalization115
C.1Locale Setting115
C.2Emulated Locale116
C.3Character Encodings116
C.3.1Java Compiler Encoding Setting117
Contentsvii
C.4Font Support in the Default Emulator117
Index119
viiiJ2ME Wireless Toolkit User’s Guide • October 2004
Preface
This document describes how to work with the J2ME Wireless Toolkit.
Who Should Use This Book
This guide is intended for developers creating Mobile Information Device Profile
(MIDP) applications with the J2ME Wireless Toolkit. You should already
understand how to use, the Mobile Information Device Profile (MIDP), and the
Connected Limited Device Configuration (CLDC)
If you need help getting started with Java programming, try the New to Java Center:
http://java.sun.com/learning/new2java/
For a quick start with MIDP programming, read Learning Path: Getting Started with
MIDP 2.0:
This book is not a tutorial in MIDP programming, nor is it a tutorial in
programming any of the additional APIs that are supported by the toolkit. This
section lists related specifications. Although specifications are definitive, they are
not always the most accessible kind of information. For a variety of developercentered articles, try Sun’s mobility web site:
Prefaceix
http://developers.sun.com/techtopics/mobility/
TopicTitle
Customizing the J2ME Wireless ToolkitJ2ME Wireless Toolkit Basic Customization Guide
Release NotesJ2ME Wireless Toolkit Release Notes
MIDP 1.0 - JSR 37Mobile Information Device Profile for the J2ME™
Platform
MIDP 2.0 - JSR 118Mobile Information Device Profile 2.0
We are interested in improving our documentation and welcome your comments
and suggestions. You can email your comments to us at:
wtk-comments@sun.com
xiiJ2ME Wireless Toolkit User’s Guide • October 2004
CHAPTER
1
Introduction
This book describes how to use the J2ME Wireless Toolkit.
The J2ME Wireless Toolkit is a set of tools that makes it possible to create
applications for mobile phones and other wireless devices. Although it is based on
the Mobile Information Device Profile (MIDP) 2.0, the J2ME Wireless Toolkit also
supports a handful of optional packages, making it a widely capable development
toolkit.
1.1Quick Start
If you’d like to get started right away, try the demonstration applications that are
included with the J2ME Wireless Toolkit.
To run the demonstrations, start KToolbar. On Windows you’ll do this by choosing
Start > Programs > J2ME Wireless Toolkit 2.2 > KToolbar.
like this:
1. Depending on how Windows is configured, you mightneed tochoose Start> AllPrograms instead of Start> Programs.
1
You’ll see a window
1
FIGURE 1The KToolbar window
Next, click on the Open Project... button to open a demonstration application.
You'll see a list of all the available applications. Pick one of them and click on the
Open Project button in the dialog.
Once the application is open, all you need to do is press the Run button. The
emulator will pop up running the example application.
Most demonstrations are self-explanatory, but some have additional instructions.
See Appendix A, “Application Demonstrations,” for additional details.
All the source code for the demonstration applications is available in the
{toolkit}\apps directory. Each demonstration has its own project directory. Inside
the project directory, the source files are in the src directory. For example, the
source code for the games demonstration is in {toolkit}\apps\games\src
directory.
1.2The Tools in the Toolkit
The J2ME Wireless Toolkit has three main components:
■ KToolbar automates many of the tasks involved in creating MIDP applications.
■ The emulator is a simulated mobile phone. It is useful for testing MIDP
applications.
■ A collection of utilities provides other useful functionality, including a text
messaging console and cryptographic utilities.
2J2ME Wireless Toolkit User’s Guide • October 2004
KToolbar is the center of the toolkit. You can use it to build applications, launch the
emulator, and start the utilities. Alternately, the emulator and utilities can be run
by themselves, which is useful in many situations. If you want to demonstrate
MIDP applications, for example, it’s useful to run the emulator by itself.
The only additional tool you need is a text editor for editing source code.
1.3Toolkit Features
The J2ME Wireless Toolkit supports the creation of MIDP applications with the
following main features:
■ Building and packaging: You write the source code and the toolkit takes care of
the rest. With the push of a button, the toolkit compiles the source code,
preverifies the class files, and packages a MIDlet suite.
■ Running and monitoring: You can run a MIDlet suite directly in the emulator or
install it using a process that resembles application installation on a real device.
A memory monitor, network monitor, and method profiler are provided to
analyze the operation of your MIDlets.
■ MIDlet suite signing: The toolkit contains tools for cryptographically signing
MIDlet suites. This is useful for testing the operation of MIDlets in different
protection domains.
1.4Supported Technology
The J2ME Wireless Toolkit supports many standard Application Programming
Interfaces (APIs) defined through the Java Community Process (JCP). TABLE 1
shows the APIs and includes links to the specifications.
TABLE1Supported JCP APIs in the J2ME Wireless Toolkit
JSR
API
JSR 139
CLDC 1.1
JSR 118
MIDP 2.0
JSR 185
JTWI 1.0
JSR 205
WMA 2.0
Name
URL
Connected Limited Device Configuration
http://jcp.org/en/jsr/detail?id=139
Mobile Information Device Profile
http://jcp.org/en/jsr/detail?id=118
Java Technology for the Wireless Industry
http://jcp.org/en/jsr/detail?id=185
Wireless Messaging API
http://jcp.org/en/jsr/detail?id=205
Chapter 1Introduction3
TABLE1Supported JCP APIs in the J2ME Wireless Toolkit
JSR
API
JSR 135
MMAPI 1.1
JSR 75
PIM and File
JSR 82
Bluetooth and OBEX
Name
URL
Mobile Media API
http://jcp.org/en/jsr/detail?id=135
PDA Optional Packages for the J2ME Platform
http://jcp.org/en/jsr/detail?id=75
Java APIs for Bluetooth
http://jcp.org/en/jsr/detail?id=82
JSR 172J2ME Web Services Specification
http://jcp.org/en/jsr/detail?id=172
JSR 184
3D Graphics
Mobile 3D Graphics API for J2ME
http://jcp.org/en/jsr/detail?id=184
4J2ME Wireless Toolkit User’s Guide • October 2004
CHAPTER
2
Developing MIDlet Suites
This chapter describes how you can use the J2ME Wireless Toolkit to create
applications. It begins with a description of toolkit projects, then works through the
development process.
There are two basic development cycles you are likely to follow in creating MIDlet
suite applications. The first is quicker and simpler; you will probably use it in your
initial development. The second cycle is longer but allows for more comprehensive
and realistic testing.
Toward the end of the chapter you’ll read about how to use the J2ME Wireless
Toolkit with advanced development tools like an obfuscator and a debugger. A
final section briefly describes how to configure a web server to serve MIDP
applications.
2.1About Projects
In the J2ME Wireless Toolkit, MIDlet suites are organized into projects, where the
end result of one project is one MIDlet suite. A project contains all of the files that
will be used to build a MIDlet suite, including Java source files, resource files, and
the MIDlet descriptor.
The J2ME Wireless Toolkit works on one project at a time. You can create a new
project or open an existing project.
In this chapter you will work with a very simple example project. As you read
about each step in the development cycles, you can work along in the toolkit.
To create a new project, first start KToolbar. On Windows, choose Start > Programs> J2ME Wireless Toolkit 2.2 > KToolbar.
2. Depending on how Windows is configured, you mightneed tochoose Start> AllPrograms instead of Start> Programs.
2
You’ll see the KToolbar window.
5
FIGURE 2The KToolbar window
Click on New Project... The toolkit will ask you for the name of the project and the
name of the MIDlet class you will write. Fill in the names and click Create Project.
FIGURE 3Creating a new project
The project options automatically pop up, allowing you to set up the build
environment for the project. The default options are fine for this example; just click
on OK to dismiss the window. In the KToolbar console, you’ll see some messages
telling you exactly where to store the source code and resource files for this project.
6J2ME Wireless Toolkit User’s Guide • October 2004
FIGURE 4File locations in the console
2.2The Simple Development Cycle
The simple development cycle looks like this:
Edit source code → Build → Run
1. Edit source code. In this step, you create Java source files and resource files that
will be used by your application.
2. Build. The J2ME Wireless Toolkit compiles and preverifies your Java source files.
3. Run. The compiled Java class files are run on the emulator.
If an error occurs when the toolkit attempts to compile your source files, go back
and edit them again. If you find a bug when you are testing your application in the
emulator, edit the source files to fix the bug.
Now that you understand the simple development cycle at a high level, the rest of
this section illustrates how you can accomplish each step using the J2ME Wireless
Toolkit.
2.2.1Edit Source Code
Editing source code is the only step in which the J2ME Wireless Toolkit is no help
at all. You will need to use the text editor of your choice to create and edit source
code files.
Chapter 2Developing MIDlet Suites7
If you are following along with the example project, create a new Java source file
TinyMIDlet.java. It should be saved in the source directory of your project,
which will be {toolkit}\apps\Tiny\src\TinyMIDlet.java where {toolkit} is the
installation directory of the toolkit. The contents of the file are a very simple
MIDlet:
public class TinyMIDlet
extends MIDlet
implements CommandListener {
public void startApp() {
Display display = Display.getDisplay(this);
Form mainForm = new Form("TinyMIDlet");
mainForm.append("Welcome to the world of MIDlets!");
Command exitCommand = new Command("Exit", Command.EXIT, 0);
mainForm.addCommand(exitCommand);
mainForm.setCommandListener(this);
display.setCurrent(mainForm);
}
public void pauseApp () {}
public void destroyApp(boolean unconditional) {}
public void commandAction(Command c, Displayable s) {
if (c.getCommandType() == Command.EXIT)
notifyDestroyed();
}
}
Save the file when you’re finished.
2.2.2Build
The next step is to build your source code. The toolkit makes this part very easy.
In the KToolbar window, click on the Build button. Assuming you saved your
source file in the right place, the toolkit will find it and compile it. Compilation
errors are displayed in the KToolbar console. If you have errors, go back and edit
the source code to fix them. Once you’ve eliminated your errors, the KToolbar
console tells you the project was successfully built.
8J2ME Wireless Toolkit User’s Guide • October 2004
FIGURE 5Messages about building
Behind the scenes, the J2ME Wireless Toolkit also preverifies the compiled class
files. MIDlet class files must be preverified before they can be run on a MIDP
device or emulator. The toolkit quietly handles this detail for you; you probably
won’t ever realize it’s happening. See the CLDC specification for more information
on preverification.
2.2.3Run
Once the project builds successfully, you are ready to try it out in the emulator.
Click on the Run button. The emulator pops up and shows a list of all the MIDlets
in your project.
Chapter 2Developing MIDlet Suites9
FIGURE 6List of project MIDlets
Choose the MIDlet you want and select Launch. If you’re following along with the
TinyMIDlet example, you’ll see the fruit of your labors:
FIGURE 7TinyMIDlet in action
10J2ME Wireless Toolkit User’s Guide • October 2004
2.3The Full Development Cycle
The second development cycle is slightly more complicated:
Edit source code → Package → Install → Run
1. Edit source code. This is the same as in the simple cycle.
2. Package. In this step, the J2ME Wireless Toolkit compiles and preverifies the
source files (essentially the same as the Build step from before). Then it bundles
the Java class files and resource files into a MIDlet suite JAR file and a MIDlet
suite descriptor.
3. Install. MIDlet suites need to be installed before they can be run. You can install
the MIDlet suite into the J2ME Wireless Toolkit emulator or a real device.
4. Run. As in the simple development cycle, run your application and test for
bugs.
In the full development cycle, the first step is identical to the simple development
cycle. Editing source code is the same as always. The Build step is now
incorporated in packaging.
The full development cycle includes two new steps, packaging and installing.
Finally, running an installed application is different in important ways from
running an application in the simple development cycle.
2.3.1Package
The J2ME Wireless Toolkit automates the task of packaging a MIDlet suite. The end
result of packaging is two files, a MIDlet descriptor and a MIDlet suite JAR. The
descriptor is a small text file that contains information about the MIDlet suite. The
JAR contains the class files and resources that make up the MIDlet suite. Devices
can use the descriptor to learn about the application before downloading the entire
JAR, an important consideration in a memory-lean, bandwidth-starved wireless
world.
To ask the toolkit to package your MIDlet suite, choose Project > Package > CreatePackage from the KToolbar menu. The MIDlet suite descriptor and JAR are
generated and placed in the bin directory of your project.
Packaging might involve additional steps. You can use a code obfuscator to shrink
the size of the MIDlet suite JAR, a technique that is described later in this chapter.
In addition, the J2ME Wireless Toolkit provides tools to allow you to
cryptographically sign MIDlet suites. See Chapter 6, “Security and MIDlet
Signing,” for more information.
Chapter 2Developing MIDlet Suites11
2.3.2Install
To properly test a MIDlet suite, you should install it into the toolkit’s emulator or a
real device. When you press the Run button in KToolbar, the MIDlet suite is not
installed into the emulator. Instead, the emulator runs the MIDlet classes directly.
The emulator also has the capability of installing applications into its memory in a
process that resembles how applications are transmitted and installed on real
devices. To install applications in the J2ME Wireless Toolkit emulator, choose
Project > Run via OTA.
The emulator window pops open, but instead of running your MIDlet classes
directly, this time the emulator shows the welcome screen of its Application
Management Software (AMS). The emulator’s AMS is an example of the type of
software that real devices must have to manage MIDlet suites.
FIGURE 8Emulator AMS welcome screen
Choose Apps to go to the main list of installed applications. Select Install
Application and press the select button on the emulator. The emulator prompts
you for the URL location of the application you want to install. The URL is already
filled in for you.
12J2ME Wireless Toolkit User’s Guide • October 2004
FIGURE 9URL prompt
Choose Go from the menu to begin the installation. The emulator shows a list of
the applications it finds at the URL. Choose the only one and select Install from the
menu. The emulator gives you one last chance to confirm your intentions.
FIGURE 10Confirming the installation
Choose Install again to finish the installation. You’ll be returned to the emulator’s
installed list of applications, which now includes the application you just installed.
Chapter 2Developing MIDlet Suites13
FIGURE 11The application menu, again
Run via OTA is an extremely useful mechanism that makes it easy to install your
MIDlet suite on the toolkit emulator. Some features must be tested using this
technique, including the push registry and the installation of signed MIDlet suites.
If you want to test your MIDlet suite on a real device, you’ll need to install it first.
How this happens depends heavily on the device you are using. There are two
likely possibilities:
■ You can deploy the application on a web server, then transmit the application
from server to device using the Over the Air (OTA) protocol described in the
MIDP 2.0 specification. This is most likely the same mechanism that users will
encounter when they go to purchase or install your application.
■ You might be able to transfer the MIDlet suite to the device using a Bluetooth,
infrared, or serial connection. This is quite a bit simpler than running a web
server, and although it won’t give you any insights into the process of installing
your application on the device via OTA, it allows you to see how your
application performs on the device.
2.3.3Run
Once the application is installed, running it is simple. Just choose the application
from the list and choose Launch from the menu.
14J2ME Wireless Toolkit User’s Guide • October 2004
FIGURE 12Launching the installed application
Running an application on a real device depends heavily on the device itself.
Consult your device documentation for information.
2.4Using an Obfuscator
An obfuscator is a tool that reduces the size of class files. MIDlet suites need to be
compact, both to minimize download times and to comply with sometimes
stringent limits on JAR size imposed by manufacturers or carriers. Using an
obfuscator is one way (not the only way) that you can keep your MIDlet suite JAR
small.
You can use an obfuscator in the packaging step of the development cycle.
Although the J2ME Wireless Toolkit doesn’t come with an obfuscator, it is already
configured to use the ProGuard obfuscator. All you need to do is download
ProGuard and put it in a place where the toolkit can find it.
ProGuard is published under the terms of the GNU General Public License (GPL).
If you are comfortable with the terms of the license, you can download and use
ProGuard free of charge.
Installing ProGuard in the J2ME Wireless Toolkit is straightforward:
1. Go to the ProGuard web site, http://proguard.sourceforge.net/.
2. Download the latest version.
Chapter 2Developing MIDlet Suites15
3. Uncompress the proguard.jar file from the lib directory of the ProGuard
installation to the bin directory of your J2ME Wireless Toolkit installation.
Once ProGuard is installed, you can use it by choosing Project > Package > CreateObfuscated Package.
In some cases you will need to provide a script file that controls how the obfuscator
works. If you are loading classes using Class.forName(), for example, you need
to tell ProGuard to leave the class names unchanged.
Create a script file using a text editor, then save it under the project’s main
directory. Consult the ProGuard documentation for information on script files.
Next you need to tell the toolkit how to find this file. To do this, edit
{toolkit}\wtklib\{platform}\ktools.properties, where {platform} is the name of
your underlying platform (most likely Windows or Linux). Add a line as follows:
obfuscate.script.name: scriptfile
Replace “scriptfile” with the name you used for the script file. You will need to quit
and restart KToolbar for the change to take effect.
The J2ME Wireless Toolkit also includes support for RetroGuard. If you want to use
RetroGuard, you’ll need to download it separately and change the toolkit’s
configuration.
1. Go to the RetroGuard web site, http://www.retrologic.com/retroguard-
main.html.
2. Download the latest version.
3. Extract the retroguard.jar file from downloaded zip file to the bin directory
of your J2ME Wireless Toolkit installation.
4. Edit {toolkit}\wtklib\{platform}\ktools.properties so that it uses the
RetroGuard obfuscator plug-in:
If you want to use a different obfuscator, you’ll have to implement an obfusctor
plug-in yourself. See the J2ME Wireless Toolkit Basic Customization Guide for an
example of how to implement an obfuscator plug-in.
16J2ME Wireless Toolkit User’s Guide • October 2004
2.5Using a Debugger
A variation on running your application is running it with a debugger. A debugger
allows you to monitor the running application more closely, set breakpoints, and
examine variables.
You will need to supply your own debugger. You can use the jdb debugger from
J2SE™ or another debugger of your choice.
Begin by choosing Project > Debug from the KToolbar menu. Enter the TCP/IP
port number that the debugger will use to connect to the emulator. Click on
Debug. The emulator begins running and waits for a connection from a debugger.
Start up your debugger and attach it to the port you specified. Make sure to set the
remote debugger to run in remote mode and to use TCP/IP. For more information,
consult the debugger’s documentation.
Information about using jdb with the J2ME Wireless Toolkit is here:
The MIDP 2.0 specification includes the Over The Air User Initiated ProvisioningSpecification, which describes how MIDlet suites can be transferred over-the-air
(OTA) to a device. You can test this type of scenario using the J2ME Wireless
Toolkit emulator.
To deploy a packaged MIDP application remotely on a Web server:
1. Change the JAD file’s MIDlet-Jar-URL property to the URL of the JAR file. The
2. Ensure that the Web server uses the correct MIME types for JAD and JAR files:
a. For MIDlet suite descriptors, map the .jad extension to the text/
vnd.sun.j2me.app-descriptor MIME type.
b. For MIDlet suite JARs, map the .jar extension to the application/java-
archive MIME type.
Chapter 2Developing MIDlet Suites17
The details of how to configure a Web server depend on the specific software used.
The emulator implements the device behavior during OTA provisioning. You can
use the emulator to test and demonstrate the full provisioning process of MIDlet
suites from a server to the device. All you need to do is launch the emulator’s
AMS. (You may already be familiar with the AMS if you have used KToolbar’s Runvia OTA option.
To launch the emulator’s AMS, you have two options:
■ In the Windows start menu, choose Start > Programs > J2ME Wireless Toolkit
2.2 > OTA Provisioning.
■ From the command line, run:
{toolkit}\bin\emulator -Xjam
Now follow the AMS prompts to install your application. This process is very
similar to the Run via OTA option described earlier in this chapter, except you will
need to enter the URL of your own server to install your application.
18J2ME Wireless Toolkit User’s Guide • October 2004
Loading...
+ 104 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.