Sun Microsystems J2ME User Manual

Browse online or download User Manual for Software manuals Sun Microsystems J2ME. Sun Microsystems J2ME User's Manual

  • Download
  • Add to my manuals
  • Print
  • Page
    / 134
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 0
Sun Microsystems, Inc.
4150 Network Circle
Santa Clara, California 95054
U.S.A.
1-800-555-9SUN or 1-650-960-1300
User’s Guide
J2ME Wireless Toolkit
2.2
October 2004
Page view 0
1 2 3 4 5 6 ... 133 134

Summary of Contents

Page 1 - User’s Guide

Sun Microsystems, Inc.4150 Network CircleSanta Clara, California 95054U.S.A.1-800-555-9SUN or 1-650-960-1300User’s GuideJ2ME Wireless Toolkit2.2Octobe

Page 2

x J2ME Wireless Toolkit User’s Guide • October 2004http://developers.sun.com/techtopics/mobility/How This Book Is OrganizedThis guide contains the fol

Page 3 - Contents

88 J2ME Wireless Toolkit User’s Guide • October 2004A.6.1 Simple TonesThe Simple Tones example demonstrates how to use interactive synthetic tones.The

Page 4

Appendix A Application Demonstrations 89 Video Capture Simulation simulates viewing input video such as might bepossible on a device equipped with a

Page 5 - Contents v

90 J2ME Wireless Toolkit User’s Guide • October 2004The commands may or may not be available depending on the media type thatSimple Player is playing.

Page 6

Appendix A Application Demonstrations 91Animated GIFs and video capture can be implemented using either a Form Item ora Canvas. The Video demonstratio

Page 7 - Contents vii

92 J2ME Wireless Toolkit User’s Guide • October 2004Run two instances of the emulator. One listens for incoming connections, while theother attempts t

Page 8 - Index 119

Appendix A Application Demonstrations 93FIGURE 48 Prompting to accept a connectionChoose Yes. The image you selected is transferred over the simulated

Page 9 - Related Documentation

94 J2ME Wireless Toolkit User’s Guide • October 2004A.8 PDAPDemoPDAPDemo shows how to use the PIM and FileConnection APIs that are part ofthe JSR 75 s

Page 10 - How This Book Is Organized

Appendix A Application Demonstrations 95FIGURE 51 Contents of the root1 directoryUsing the commands in the demonstration, you can view the file or see

Page 11 - Preface xi

96 J2ME Wireless Toolkit User’s Guide • October 2004The actual files are located in{toolkit}\appdb\DefaultColorPhone\filesystem, assuming you are usin

Page 12 - We Welcome Your Comments

Appendix A Application Demonstrations 97FIGURE 54 An empty contact listTo add an item, choose New from the menu. The application prompts you for aForm

Page 13 - Introduction

Preface xiChapter 7 details support for running and testing wireless messagingapplications.Chapter 8 explains how the J2ME Wireless Toolkit supports t

Page 14 - 1.2 The Tools in the Toolkit

98 J2ME Wireless Toolkit User’s Guide • October 2004FIGURE 56 Saving an itemYou can return to the list by choosing the Back command. You'll see t

Page 15 - 1.4 Supported Technology

Appendix A Application Demonstrations 99To see the magic of the push registry, use the WMA console to send the emulator amessage. Launch the console b

Page 16

100 J2ME Wireless Toolkit User’s Guide • October 2004FIGURE 58 The push registry springs to lifeChoose Yes. The SMSReceive MIDlet is launched and imme

Page 17 - Developing MIDlet Suites

Appendix A Application Demonstrations 101If you are attempting to send text messages to WMADemo using the WMA console,make sure to specify the port nu

Page 18 - Creating a new project

102 J2ME Wireless Toolkit User’s Guide • October 2004FIGURE 61 Adding parts to an MMS messageClick on Send to send the message.The emulator asks if it

Page 19 - 2.2.1 Edit Source Code

103APPENDIXBCommand Line ReferenceThis appendix describes how to operate the J2ME Wireless Toolkit from thecommand line and details the steps required

Page 20 - 2.2.2 Build

104 J2ME Wireless Toolkit User’s Guide • October 2004B.2.1 BuildUsing KToolbar, building a project is a single step. Behind the scenes, however,there

Page 21 - 2.2.3 Run

Appendix B Command Line Reference 105As a result of this command, preverified class files are placed in the classesdirectory. If your application uses

Page 22 - TinyMIDlet in action

106 J2ME Wireless Toolkit User’s Guide • October 2004For example, a JAD file might have the following contents:MIDlet-Name: MyMIDletMIDlet-Vendor: My

Page 23 - 2.3.1 Package

Appendix B Command Line Reference 107remove=[<storage_name>|<storage_number> | all]Remove a previously installed application. The applicat

Page 24 - 2.3.2 Install

xii J2ME Wireless Toolkit User’s Guide • October 2004Typographic ConventionsAccessing Documentation OnlineThe following sites provide technical docume

Page 25 - Confirming the installation

108 J2ME Wireless Toolkit User’s Guide • October 2004B.3 Launching Toolkit GUI ComponentsThe components of the J2ME Wireless Toolkit can all be launch

Page 26 - 2.3.3 Run

Appendix B Command Line Reference 109kvem.memory.monitor.enable Monitor > Enable memory monitorValue: true | falsekvem.netmon.comm.enable Monitor &

Page 27 - 2.4 Using an Obfuscator

110 J2ME Wireless Toolkit User’s Guide • October 2004B.5 Using Security FeaturesThe full spectrum of the J2ME Wireless Toolkit’s security features are

Page 28

Appendix B Command Line Reference 111B.5.2 Signing MIDlet SuitesJadTool is a command-line interface for signing MIDlet suites using public keycryptogr

Page 29 - 2.5 Using a Debugger

112 J2ME Wireless Toolkit User’s Guide • October 2004B.5.3 Managing CertificatesMEKeyTool manages the public keys of certificate authorities (CAs), ma

Page 30 - ■ From the command line, run:

Appendix B Command Line Reference 113B.6 Using the Stub GeneratorJ2ME Clients can use the Stub Generator to access web services. The wscompiletool gen

Page 31

114 J2ME Wireless Toolkit User’s Guide • October 2004Note – Exactly one -gen option must be specified. The -f option requires acomma-separated list of

Page 32 - The project settings window

115APPENDIXCInternationalizationThis appendix describes setting the language displayed in the J2ME WirelessToolkit and the localization setting of the

Page 33

116 J2ME Wireless Toolkit User’s Guide • October 2004C.2 Emulated LocaleThe microedition.locale property is the MIDP system property that definesthe c

Page 34

Appendix C Internationalization 117Note – All the J2SE encoders are available in the emulated environment. See theJ2ME Wireless Toolkit Basic Customiz

Page 35 - 3.3 Manipulating MIDlets

1CHAPTER1IntroductionThis book describes how to use the J2ME Wireless Toolkit.The J2ME Wireless Toolkit is a set of tools that makes it possible to cr

Page 36 - 3.4 Using the Push Registry

118 J2ME Wireless Toolkit User’s Guide • October 2004

Page 37 - Project directory structure

119IndexAadvanced configuration options, 26application descriptor, 11Application Management Software (AMS), 12applicationsrunning remotely, 17applicati

Page 38 - 3.7 Configuring KToolbar

120 J2ME Wireless Toolkit User’s Guide • October 2004IrDA, 73JJAD, 11attributes, 21creating, 11MIME type, 17JARcreating, 11MIME type, 17Java Cryptogra

Page 39

Index 121push registry, 24Rremotely-deployed applications, 17revision control, 27revision control files, 27Revision Control System (RCS), 27RevisionCon

Page 40

122 J2ME Wireless Toolkit User’s Guide • October 2004

Page 41 - Using the Emulator

2 J2ME Wireless Toolkit User’s Guide • October 2004FIGURE 1 The KToolbar windowNext, click on the Open Project... button to open a demonstration appli

Page 42 - 4.2 Using the Emulator

Chapter 1 Introduction 3KToolbar is the center of the toolkit. You can use it to build applications, launch theemulator, and start the utilities. Alte

Page 43

4 J2ME Wireless Toolkit User’s Guide • October 2004JSR 135MMAPI 1.1Mobile Media APIhttp://jcp.org/en/jsr/detail?id=135JSR 75PIM and FilePDA Optional P

Page 44 - 4.3.1 Network Proxies

5CHAPTER2Developing MIDlet SuitesThis chapter describes how you can use the J2ME Wireless Toolkit to createapplications. It begins with a description

Page 45 - 4.3.3 Storage and Cleaning

6 J2ME Wireless Toolkit User’s Guide • October 2004FIGURE 2 The KToolbar windowClick on New Project... The toolkit will ask you for the name of the pr

Page 46

Chapter 2 Developing MIDlet Suites 7FIGURE 4 File locations in the console2.2 The Simple Development CycleThe simple development cycle looks like this

Page 47 - 4.4 Pausing and Resuming

PleaseRecycleCopyright © 2004 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved.U.S. Government R

Page 48 - 4.5 Running the Emulator Solo

8 J2ME Wireless Toolkit User’s Guide • October 2004If you are following along with the example project, create a new Java source fileTinyMIDlet.java.

Page 49

Chapter 2 Developing MIDlet Suites 9FIGURE 5 Messages about buildingBehind the scenes, the J2ME Wireless Toolkit also preverifies the compiled classfi

Page 50

10 J2ME Wireless Toolkit User’s Guide • October 2004FIGURE 6 List of project MIDletsChoose the MIDlet you want and select Launch. If you’re following

Page 51 - Monitoring Applications

Chapter 2 Developing MIDlet Suites 112.3 The Full Development CycleThe second development cycle is slightly more complicated:Edit source code → Packag

Page 52 - The method profiler

12 J2ME Wireless Toolkit User’s Guide • October 20042.3.2 InstallTo properly test a MIDlet suite, you should install it into the toolkit’s emulator or

Page 53 - 5.1.1 The Call Graph

Chapter 2 Developing MIDlet Suites 13FIGURE 9 URL promptChoose Go from the menu to begin the installation. The emulator shows a list ofthe application

Page 54 - 5.2 Using the Memory Monitor

14 J2ME Wireless Toolkit User’s Guide • October 2004FIGURE 11 The application menu, againRun via OTA is an extremely useful mechanism that makes it ea

Page 55

Chapter 2 Developing MIDlet Suites 15FIGURE 12 Launching the installed applicationRunning an application on a real device depends heavily on the devic

Page 56 - 5.3 Using the Network Monitor

16 J2ME Wireless Toolkit User’s Guide • October 20043. Uncompress the proguard.jar file from the lib directory of the ProGuardinstallation to the bin

Page 57 - 5.3.1 Filtering Messages

Chapter 2 Developing MIDlet Suites 172.5 Using a DebuggerA variation on running your application is running it with a debugger. A debuggerallows you t

Page 58 - Information

Contents iiiContentsPreface ix1. Introduction 11.1 Quick Start 11.2 The Tools in the Toolkit 21.3 Toolkit Features 31.4 Supported Technology 32. Devel

Page 59

18 J2ME Wireless Toolkit User’s Guide • October 2004The details of how to configure a Web server depend on the specific software used.The emulator imp

Page 60

19CHAPTER3Working With ProjectsIn the last chapter, you learned how the J2ME Wireless Toolkit helps you with theMIDP development cycle. This chapter d

Page 61 - Security and MIDlet Signing

20 J2ME Wireless Toolkit User’s Guide • October 2004FIGURE 13 The project settings windowOn the API Selection tab, the Target Platform setting control

Page 62 - 6.2 Protection Domains

Chapter 3 Working With Projects 213.2 Changing MIDlet Suite AttributesThe project settings window also allows you to control the MIDlet suite attribut

Page 63 - 6.3 Signing a MIDlet Suite

22 J2ME Wireless Toolkit User’s Guide • October 2004FIGURE 14 Editing MIDlet suite attributesTo create new user-defined attributes, click on the User

Page 64 - 6.4 Managing Keys

Chapter 3 Working With Projects 233.3 Manipulating MIDletsThe project settings also provide a way to add or modify the MIDlets that arecontained in th

Page 65 - 6.4.2 Getting Real Keys

24 J2ME Wireless Toolkit User’s Guide • October 2004The MIDlet names are presented to the user in the order shown when the MIDletsuite is launched. Yo

Page 66 - 6.5 Managing Certificates

Chapter 3 Working With Projects 25If you do make push registry entries for your application, make sure you also enterthe appropriate permissions. See

Page 67 - 6.5.1 Importing Certificates

26 J2ME Wireless Toolkit User’s Guide • October 2004When you use a third-party library in your application, your JAR will expand bythe size of the thi

Page 68 - 6.5.2 Removing Certificates

Chapter 3 Working With Projects 273.7.1 Setting the Application DirectoryBy default, the J2ME Wireless Toolkit stores applications in directories unde

Page 69

iv J2ME Wireless Toolkit User’s Guide • October 20043.1 Selecting APIs 193.2 Changing MIDlet Suite Attributes 213.3 Manipulating MIDlets 233.4 Using t

Page 70 - Setting WMA preferences

28 J2ME Wireless Toolkit User’s Guide • October 2004

Page 71 - The WMA console

29CHAPTER4Using the EmulatorThe J2ME Wireless Toolkit emulator simulates a MIDP device on your desktopcomputer. It is a convenient way to see how your

Page 72

30 J2ME Wireless Toolkit User’s Guide • October 20044.2 Using the EmulatorThe emulator looks and acts like a mobile phone. In this section you’ll lear

Page 73 - Sending a binary message

Chapter 4 Using the Emulator 31FIGURE 17 The DefaultColorPhone emulator skin

Page 74 - 7.3.4 Sending MMS Messages

32 J2ME Wireless Toolkit User’s Guide • October 2004You can use the mouse to click on the buttons to press them. Most buttons alsohave keyboard shortc

Page 75

Chapter 4 Using the Emulator 334.3.2 Heap SizeThe heap is memory where your application’s objects are stored. Many real deviceshave limited heap size.

Page 76

34 J2ME Wireless Toolkit User’s Guide • October 2004The toolkit enables you to choose a different location for the storage files, and youcan limit the

Page 77 - Using the Mobile Media API

Chapter 4 Using the Emulator 35FIGURE 19 Adjusting the emulator’s performanceAdjust the Graphics primitives latency to have an effect on the amount of

Page 78 - 8.4 Well-Behaved MIDlets

36 J2ME Wireless Toolkit User’s Guide • October 2004When the emulator is running, choose MIDlet > Pause from the emulatorwindow’s menu. The running

Page 79 - 9.2 Immediate Mode

Chapter 4 Using the Emulator 37is usually to unpack or install the third party emulator, then copy its directory intothe <toolkit>/wtklib/device

Page 80 - 9.3 Retained Mode

Contents v5.3.1 Filtering Messages 455.3.2 Sorting Messages 465.3.3 Saving and Loading Network Monitor Information 465.3.4 Clearing the Message Tree 4

Page 81

38 J2ME Wireless Toolkit User’s Guide • October 2004

Page 82

39CHAPTER5Monitoring ApplicationsThe J2ME Wireless Toolkit provides several tools to monitor the behavior of yourapplications. These tools are helpful

Page 83 - 10.1 The FileConnection API

40 J2ME Wireless Toolkit User’s Guide • October 2004FIGURE 20 Turning on the profilerNow run your application by clicking on the Run button. Interact

Page 84 - 10.2 The PIM API

Chapter 5 Monitoring Applications 41 The right side of the profiler shows the execution time and number of calls foreach method and its descendants.N

Page 85 - Using the Bluetooth and OBEX

42 J2ME Wireless Toolkit User’s Guide • October 20045.1.3 Saving and Loading Profiler InformationTo save your profiler session, click on the Save butt

Page 86 - 11.3.1 OBEX Preferences

Chapter 5 Monitoring Applications 43 Maximum. The maximum amount of memory used since program executionbegan, shown in the graph by a broken red line

Page 87 - BCC properties

44 J2ME Wireless Toolkit User’s Guide • October 2004 Name. The class name of the objects. Live. The number of instances. Some of these might be elig

Page 88

Chapter 5 Monitoring Applications 45FIGURE 24 The network monitorWhen your application makes any type of network connection, information aboutthe conn

Page 89 - Using Web Services

46 J2ME Wireless Toolkit User’s Guide • October 2004Press the Filter Settings button to use the filter. Change the filter settings to suityour needs.W

Page 90

Chapter 5 Monitoring Applications 47To load a network monitor session, choose File > Utilities... from the KToolbarmenu. Click on Open Session in t

Page 91 - Application Demonstrations

vi J2ME Wireless Toolkit User’s Guide • October 20048.4 Well-Behaved MIDlets 669. Working With Mobile 3D Graphics 679.1 JSR 184 Overview 679.2 Immedia

Page 92 - WMADemo is contained in

48 J2ME Wireless Toolkit User’s Guide • October 2004

Page 93 - A.2 General Instructions

49CHAPTER6Security and MIDlet SigningMIDP 2.0 includes a comprehensive security model based on protection domains.MIDlet suites are installed into a p

Page 94 - A.3 BluetoothDemo

50 J2ME Wireless Toolkit User’s Guide • October 2004In the J2ME Wireless Toolkit, you can add these permission attributes to a projectby clicking on t

Page 95

Chapter 6 Security and MIDlet Signing 51 MIDlets in the minimum domain are denied all permissions. The untrusted domain provides a high level of sec

Page 96 - A.4 Demo3D

52 J2ME Wireless Toolkit User’s Guide • October 2004FIGURE 26 The MIDlet suite signing windowSigning is very easy. Just select the key you want to use

Page 97 - A.4.2 PogoRoo

Chapter 6 Security and MIDlet Signing 53FIGURE 27 Creating a new key pairAfter you click on Create, the toolkit prompts you to choose a protection dom

Page 98 - A.4.3 retainedmode

54 J2ME Wireless Toolkit User’s Guide • October 2004The procedure for signing MIDlet suites with real keys works like this:1. Generate a new key pair.

Page 99 - A.6 mmademo

Chapter 6 Security and MIDlet Signing 55Real devices have similar lists of root certificates, although they cannot usually bemodified by the user. Whe

Page 100 - A.6.2 Simple Player

56 J2ME Wireless Toolkit User’s Guide • October 20046.5.2 Removing CertificatesTo remove a certificate from the list, select the certificate and choos

Page 101 - Simple Player commands

57CHAPTER7Using the Wireless Messaging APIThe J2ME Wireless Toolkit supports the Wireless Messaging API (WMA) with asophisticated simulation environme

Page 102 - A.6.4 Video

Contents viiA.6.1 Simple Tones 87A.6.2 Simple Player 87A.6.3 PausingAudioTest 89A.6.4 Video 89A.6.5 Attributes for mmademo 90A.7 ObexDemo 90A.8 PDAPDe

Page 103 - A.7 ObexDemo

58 J2ME Wireless Toolkit User’s Guide • October 2004FIGURE 29 Setting WMA preferencesThe Phone Number of Next Emulator field is just what it sounds li

Page 104

Chapter 7 Using the Wireless Messaging API 597.3 Sending Messages With the WMAConsoleThe WMA console is a handy utility that allows you to send and re

Page 105

60 J2ME Wireless Toolkit User’s Guide • October 2004FIGURE 31 Sending a text messageThe window automatically lists the phone numbers of all running em

Page 106 - A.8 PDAPDemo

Chapter 7 Using the Wireless Messaging API 61FIGURE 32 Sending a binary messageSelecting recipients is the same as for sending text SMS messages. You

Page 107

62 J2ME Wireless Toolkit User’s Guide • October 2004FIGURE 33 Sending CBS messages7.3.4 Sending MMS MessagesMMS messages consist of one or more files,

Page 108 - A.8.2 The PIM API

Chapter 7 Using the Wireless Messaging API 63FIGURE 34 Adding recipients for an MMS messageTo add media files to the message, click on the Parts tab.

Page 109 - Adding contact fields

64 J2ME Wireless Toolkit User’s Guide • October 20047.4 Receiving Messages in the WMAConsoleThe WMA console can also receive messages. If you look at

Page 110 - A.9 WMADemo

65CHAPTER8Using the Mobile Media APIThe Mobile Media API (MMAPI) provides a standard API for rendering andcapturing time-based media, like audio or vi

Page 111 - Sending a text message

66 J2ME Wireless Toolkit User’s Guide • October 20048.2 Using MediaControlSkinThe J2ME Wireless Toolkit comes with an emulator skin, MediaControlSkin,

Page 112 - An incoming text message

67CHAPTER9Working With Mobile 3D GraphicsThis chapter provides a brief overview of working with 3D graphics content.9.1 JSR 184 OverviewJSR 184 is a s

Page 113 - Addressing an MMS message

viii J2ME Wireless Toolkit User’s Guide • October 2004C.4 Font Support in the Default Emulator 117Index 119

Page 114 - WMADemo receives the image

68 J2ME Wireless Toolkit User’s Guide • October 2004For an example of immediate mode, see the Life3D MIDlet in the Demo3Dexample application.9.3 Retai

Page 115 - Command Line Reference

Chapter 9 Working With Mobile 3D Graphics 699.5 Creating Mobile 3D Graphics ContentMost mobile 3D applications will use scene graphs in resource files

Page 116 - B.2.1 Build

70 J2ME Wireless Toolkit User’s Guide • October 2004

Page 117 - B.2.2 Package

71CHAPTER10Using the PIM and FileConnectionAPIsThe J2ME Wireless Toolkit supports JSR 75, the PDA Optional Packages for theJ2ME Platform. JSR 75 inclu

Page 118 - B.2.3 Run

72 J2ME Wireless Toolkit User’s Guide • October 2004Each subdirectory of filesystem is called a root. The J2ME Wireless Toolkitprovides a mechanism fo

Page 119 - B.2.4 Debugging

73CHAPTER11Using the Bluetooth and OBEXAPIsThe J2ME Wireless Toolkit emulator supports JSR 82, the Java APIs for Bluetooth.JSR 82 includes two indepen

Page 120 - Toolkit component commands

74 J2ME Wireless Toolkit User’s Guide • October 200411.3 Setting OBEX and Bluetooth PreferencesThe J2ME Wireless Toolkit allows you to configure the B

Page 121

Chapter 11 Using the Bluetooth and OBEX APIs 7511.3.2 Bluetooth Discovery TimeoutIn the Bluetooth section of the preferences window, the Device discov

Page 122 - B.5 Using Security Features

76 J2ME Wireless Toolkit User’s Guide • October 2004

Page 123 - B.5.2 Signing MIDlet Suites

77CHAPTER12Using Web ServicesThe J2ME Wireless Toolkit emulator supports JSR 172, the J2ME Web ServicesSpecification. JSR 172 provides APIs for access

Page 124 - B.5.3 Managing Certificates

Preface ixPrefaceThis document describes how to work with the J2ME Wireless Toolkit.Who Should Use This BookThis guide is intended for developers crea

Page 125 - B.6 Using the Stub Generator

78 J2ME Wireless Toolkit User’s Guide • October 2004

Page 126 - B.6.1.1 Example

79APPENDIXAApplication DemonstrationsThis appendix describes the application demonstrations that are bundled with theJ2ME Wireless Toolkit.A.1 Overvie

Page 127 - Internationalization

80 J2ME Wireless Toolkit User’s Guide • October 2004\WTK22, the source code for the SMS sender MIDlet (example.sms.SMSSend)inWMADemo is contained in\W

Page 128 - C.3 Character Encodings

Appendix A Application Demonstrations 81A.2 General InstructionsIt's usually very simple to run one of the demonstration applications. This secti

Page 129

82 J2ME Wireless Toolkit User’s Guide • October 2004FIGURE 41 Opening a demonstration application projectSelect one and click on the Open Project butt

Page 130

Appendix A Application Demonstrations 83FIGURE 42 Running the Bluetooth Demo serverOn the second emulator, choose Bluetooth Demo, then Client. The MID

Page 131

84 J2ME Wireless Toolkit User’s Guide • October 2004FIGURE 43 An image transferred via simulated BluetoothYou can avoid the permission prompts by runn

Page 132

Appendix A Application Demonstrations 85FIGURE 44 The Game of Life in three dimensionsThe keypad buttons provide control over the game.This source cod

Page 133 - Index 121

86 J2ME Wireless Toolkit User’s Guide • October 2004FIGURE 45 A bouncing kangarooYou can get the kangaroo to bounce around the landscape by using the

Page 134

Appendix A Application Demonstrations 87FIGURE 46 A tireless skateboarderA.5 JSR172DemoJSR172Demo shows how to access a web service from a MIDlet. The

Comments to this Manuals

No comments