+ All Categories
Home > Documents > Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows...

Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows...

Date post: 30-May-2020
Category:
Upload: others
View: 19 times
Download: 0 times
Share this document with a friend
82
Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java ME SDK to develop embedded applications, using both the NetBeans and Eclipse Integrated Development Environments, on a Windows XP or Windows 7 platform.
Transcript
Page 1: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Oracle® Java ME EmbeddedGetting Started Guide for the Windows Platform

Release 3.4

E35132-03

September 2013

This book describes how to use Oracle Java ME SDK to develop embedded applications, using both the NetBeans and Eclipse Integrated Development Environments, on a Windows XP or Windows 7 platform.

Page 2: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Oracle Java ME Embedded Getting Started Guide for the Windows Platform, Release 3.4

E35132-03

Copyright © 2012, 2013, Oracle and/or its affiliates. All rights reserved.

This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.

The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing.

If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable:

U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, delivered to U.S. Government end users are "commercial computer software" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, shall be subject to license terms and license restrictions applicable to the programs. No other rights are granted to the U.S. Government.

This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications.

Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group.

This software or hardware and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services.

Page 3: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

iii

Contents

Preface ................................................................................................................................................................ vii

Audience...................................................................................................................................................... viiDocumentation Accessibility .................................................................................................................... viiRelated Documents .................................................................................................................................... viiOperating System Commands ................................................................................................................ viiiShell Prompts ............................................................................................................................................. viiiConventions ............................................................................................................................................... viii

1 Before You Begin

Installing the Java SE Platform................................................................................................................ 1-1Setting and Verifying Your Java SE PATH ......................................................................................1-1

Installing the Oracle Java ME SDK Platform ....................................................................................... 1-2Installing and the Starting the NetBeans IDE ...................................................................................... 1-2Installing and Starting the Eclipse IDE ................................................................................................. 1-3Verifying the UART Prefix ....................................................................................................................... 1-6

2 Using the Oracle Java ME SDK Software with NetBeans

Downloading Oracle Java ME SDK Plugins ........................................................................................ 2-1Installing Oracle Java ME SDK Plugins ................................................................................................ 2-1

Installing Plugins Using the Update Center ....................................................................................2-1Installing NetBeans Plugins Manually ..............................................................................................2-4

Verifying Your Installation ....................................................................................................................... 2-8Creating a Sample IMlet File ................................................................................................................... 2-9Creating a New Project........................................................................................................................... 2-10Including Your Sample IMlet Code..................................................................................................... 2-14

3 Using the Emulator

The Emulator’s Main Screen ................................................................................................................... 3-1The AMS Tab ........................................................................................................................................3-2The GPIO Pins Tab ...............................................................................................................................3-3The GPIO Ports Tab .............................................................................................................................3-3The I2C Tab ...........................................................................................................................................3-4The SPI Tab ...........................................................................................................................................3-5The MMIO Tab .....................................................................................................................................3-6The ADC Tab ........................................................................................................................................3-7

Page 4: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

iv

The DAC Tab ........................................................................................................................................3-8The Pulse Counters Tab ......................................................................................................................3-8

The External Events Generator ................................................................................................................ 3-9The ADC Tab ........................................................................................................................................3-9The Access Points Tab .........................................................................................................................3-9The GPIO Tab .................................................................................................................................... 3-10The Location Tab ............................................................................................................................... 3-11The MMIO Tab .................................................................................................................................. 3-12The Pulse Counter Tab ..................................................................................................................... 3-13

Using the Device Manager .................................................................................................................... 3-13

4 Using the Oracle Java ME SDK Software with Eclipse

Installing the Oracle Java ME SDK Eclipse Plugin ............................................................................. 4-1Installing Plugins on Eclipse Indigo 3.7 ............................................................................................4-1Installing Plugins on Eclipse Kepler 4.3 and Juno 4.2 .....................................................................4-4

Configuring Eclipse ................................................................................................................................... 4-5Creating a Sample IMlet File ................................................................................................................... 4-6Creating a New Oracle Java ME SDK Project in Eclipse.................................................................... 4-7

Configuring the Application Descriptor ...........................................................................................4-9Adding a Test MIDlet to the Project ............................................................................................... 4-11Adding Sample Code to a New Project ......................................................................................... 4-12Running the IMletDemo Sample Project ....................................................................................... 4-13

A Running Sample Applications

Using the Oracle Java ME SDK Update Center to Get Sample Applications ............................... A-1Using Sample Applications in the Emulator ....................................................................................... A-1

Starting Sample Applications ............................................................................................................ A-2The GPIODemo Sample Application ............................................................................................... A-2The I2CDemo Sample Application ................................................................................................... A-4The NetworkDemoIMPNG Sample Application ........................................................................... A-5The PDAPDemoIMPNG Sample Application ................................................................................ A-6

The Light Tracker Sample Application ................................................................................................. A-7The System Controller Sample Application ........................................................................................ A-7

B Using the Command Line Emulator

Finding the Oracle Java ME SDK Emulator......................................................................................... B-1Using the Oracle Java ME SDK Emulator ............................................................................................ B-1Useful Command Line Emulator Commands...................................................................................... B-1

C Installation and Runtime Security Guidelines

Maintaining Optimum Network Security............................................................................................ C-1

Glossary ..........................................................................................................................

Page 5: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

v

List of Figures

1–1 The NetBeans Start Screen......................................................................................................... 1-31–2 The Eclipse Workspace Launcher............................................................................................. 1-41–3 The Eclipse Start Screen ............................................................................................................. 1-51–4 The Eclipse Workbench Start Screen........................................................................................ 1-62–1 The NetBeans Plugin Manager ................................................................................................. 2-22–2 Adding a Plugin Portal .............................................................................................................. 2-32–3 Creating a New Update Center ................................................................................................ 2-32–4 The Oracle Java ME SDK Plugins............................................................................................. 2-42–5 The Plugins Manager Installed Tab.......................................................................................... 2-42–6 NetBeans Plugins Manager Window....................................................................................... 2-52–7 The Downloaded Tab and Add Plugins Button..................................................................... 2-52–8 Adding Plugins ........................................................................................................................... 2-62–9 Selecting Downloaded Plugins ................................................................................................. 2-62–10 The NetBeans IDE Installer ....................................................................................................... 2-72–11 The Device Selector..................................................................................................................... 2-82–12 The Java Platform Manager....................................................................................................... 2-92–13 The New Project Screen .......................................................................................................... 2-112–14 Creating a New Project ........................................................................................................... 2-122–15 Setting the New Default Platform ......................................................................................... 2-132–16 The New IMletDemo Project.................................................................................................. 2-142–17 The IMletDemo Project Tree................................................................................................... 2-152–18 The Rename Class IMlet Dialog Box ..................................................................................... 2-152–19 The IMletDemo Projects Window ......................................................................................... 2-162–20 The NetBeans Project Window with the IMletDemo Project ............................................ 2-172–21 The NetBeans Toolbar and Menus ........................................................................................ 2-172–22 The NetBeans Emulator Window Running the IMletDemo Project ................................ 2-183–1 The Oracle Java ME SDK Emulator Toolbar and Menu Items............................................. 3-13–2 The Oracle Java ME SDK Emulator (AMS Tab) Default Screen .......................................... 3-23–3 Buttons on the AMS Tab ............................................................................................................ 3-33–4 The Emulator GPIO Pins Tab.................................................................................................... 3-33–5 The Emulator GPIO Ports Tab .................................................................................................. 3-43–6 The Emulator I2C Tab ................................................................................................................ 3-53–7 The Emulator SPI Tab................................................................................................................. 3-63–8 The Emulator MMIO Tab .......................................................................................................... 3-73–9 The Emulator ADC Tab ............................................................................................................. 3-73–10 The Emulator DAC Tab ............................................................................................................. 3-83–11 The Emulator Pulse Counters Tab............................................................................................ 3-93–12 The External Events Generator ADC Tab ............................................................................... 3-93–13 The External Events Generator Access Points Tab ............................................................. 3-103–14 The External Events Generator GPIO Tab............................................................................ 3-113–15 The External Events Generator Location Tab ...................................................................... 3-123–16 The External Events Generator MMIO Tab ......................................................................... 3-133–17 The External Events Generator Pulse Counters Tab........................................................... 3-133–18 A List of Registered Devices in the Device Manager.......................................................... 3-143–19 The Device Address Manager ................................................................................................ 3-144–1 The Eclipse Available Software Screen.................................................................................... 4-24–2 Selecting Oracle Java ME SDK Plugins.................................................................................... 4-34–3 Eclipse Plugins Installation Details .......................................................................................... 4-34–4 The Eclipse Welcome Screen ..................................................................................................... 4-44–5 Selecting Java ME for Configuration........................................................................................ 4-54–6 Creating A New Application Descriptor................................................................................. 4-84–7 The New IMletDemo Project Overview .................................................................................. 4-94–8 Configuring the Application Descriptor .............................................................................. 4-104–9 Saving Changes to the Application Descriptor ................................................................... 4-10

Page 6: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

vi

4–10 Creating a New Java MIDlet .................................................................................................. 4-114–11 Displaying the IMletDemo Test MIDlet Sample Code....................................................... 4-124–12 The IMletDemo Sample Project Code................................................................................... 4-134–13 The IMPNGDevice1 Emulator with the IMLetDemo Running ........................................ 4-14A–1 The Run IMlet Suite Dialog Box .............................................................................................. A-2A–2 The External Events Generator GPIO Tab.............................................................................. A-3A–3 The GPIO Pins Tab..................................................................................................................... A-4A–4 The I2C Tab................................................................................................................................. A-5A–5 The Manage File System Window........................................................................................... A-6

Page 7: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

vii

Preface

This book describes how to use the Oracle Java ME SDK 3.4 platform to quickly develop embedded applications on both the NetBeans and Eclipse Integrated Development Environments (IDEs). The Oracle Java ME SDK 3.4 platform contains a complete implementation of the Oracle Java ME Embedded 3.4 software runtime.

Together, these products support embedded software development on:

■ Windows 32 platform in emulation (this guide)

■ Raspberry Pi platform (Oracle Java ME Embedded Getting Started Guide for the Reference Platform (Raspberry Pi))

■ Keil MCBSTM32F200 platform, running the RTX operating system (Oracle Java ME Embedded Getting Started Guide for the Reference Platform (Keil))

■ Qualcomm Orion Internet of Everything (IoE) platform (Oracle Java ME Embedded Getting Started Guide for the Reference Platform (IoE))

AudienceThis document is intended for embedded developers who want to develop applications on Oracle Java ME SDK on a Windows XP or Windows 7 platform.

Documentation AccessibilityFor information about Oracle's commitment to accessibility, visit the Oracle Accessibility Program website at http://www.oracle.com/pls/topic/lookup?ctx=acc&id=docacc.

Access to Oracle SupportOracle customers have access to electronic support through My Oracle Support. For information, visit http://www.oracle.com/pls/topic/lookup?ctx=acc&id=info or visit http://www.oracle.com/pls/topic/lookup?ctx=acc&id=trs if you are hearing impaired.

Related DocumentsFor a complete list of documents, see the Release Notes.

Page 8: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

viii

Operating System CommandsThis document does not contain information on basic commands and procedures such as opening a terminal window, changing directories, and setting environment variables. See the software documentation that you received with your system for this information.

Shell Prompts

ConventionsThe following text conventions are used in this document:

Shell Prompt

Bourne shell and Korn shell $

Windows directory>

Convention Meaning

boldface Boldface type indicates graphical user interface elements associated with an action, or terms defined in text or the glossary.

italic Italic type indicates book titles, emphasis, or placeholder variables for which you supply particular values.

monospace Monospace type indicates commands within a paragraph, URLs, code in examples, text that appears on the screen, or text that you enter.

Page 9: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

1

Before You Begin 1-1

1Before You Begin

The Oracle Java ME SDK 3.4 platform is a sophisticated and useful tool for programmers who want to develop embedded applications. The Oracle Java ME SDK 3.4 platform can be used successfully and easily with the NetBeans 7.3.1 Integrated Development Environment, as well as the Eclipse (Indigo 3.7, Juno 4.2, or Kepler 4.3) IDE.

This chapter provides information you need to ensure that your Microsoft Windows XP (32-bit) or Windows 7 (32-bit or 64-bit) platform is correctly set up for working with Oracle Java ME SDK. Both Windows XP and Windows 7 must include the most recent Microsoft service packs.

Installing the Java SE PlatformTo properly run the Oracle Java ME SDK software and its associated Tools, you must have Java Platform, Standard Edition (Java SE), Version 7, Update 25 (or later) installed on your computer.

This guide assumes you have already installed the Java SE platform. If you have not installed Java 7, Update 25, you can download it from the following location:

http://www.oracle.com/technetwork/java/javase/downloads

The installation of Eclipse Indigo 3.7 requires Java 6, Update 17 as the reference platform. It may work with other Java versions, but it is not recommended by Eclipse. To get Java 6, Update 17:

http://www.oracle.com/technetwork/java/javase/archive-139210.html

The Java SE platform must also be in your PATH.

Setting and Verifying Your Java SE PATHTo verify if Java SE platform is set in your PATH:

1. In the Windows command line, type:

C:\>echo %PATH%

2. If Java SE is properly installed, you see a path to the default installation directory:

Note: The Oracle Java ME Embedded 3.4 runtime is fully implemented inside Oracle Java ME SDK 3.4 software. So, there is no need for you to independently install Oracle Java ME Embedded 3.4 software.

Page 10: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Installing the Oracle Java ME SDK Platform

1-2 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

C:\>Program Files\Java\jdk1.7.0_x

3. If not, you need to add Java SE to your PATH.

4. Set the Java SE variable, JDK_DIR:

C:\>set JDK_DIR=C:\Program Files\Java\jdk1.7.0_25

5. Add JDK_DIR to your PATH:

C:\>set PATH=%PATH%;%JDK_DIR%\bin

6. To verify the version of your Java SE platform, type:

C\:>java -version

The version number shown in the output should be version 1.7.0_25 or higher.

Installing the Oracle Java ME SDK PlatformFollow these steps to install the Oracle Java ME SDK 3.4.

1. If you have previously installed an earlier version of Oracle Java ME SDK, uninstall the previous version as shown below.

■ If you have Oracle Java ME SDK data to save, copy it to a safe location before continuing.

■ In the Windows system tray, right click the emulator icon and choose Exit.

■ From the Windows Programs menu, select the previous version and choose Uninstall from the submenu. The Installer opens.

■ On the first page check the option to remove the user data directory.

■ Follow the prompts.

2. Download the SDK from:

http://www.oracle.com/technetwork/java/javame/javamobile/download/sdk

3. Double-click the executable. When the installer starts, follow the prompts.

Installing and the Starting the NetBeans IDEIf you do not already have the NetBeans 7.3.1 IDE installed on your system, you can download it here:

https://netbeans.org/downloads/

Once you have downloaded the NetBeans installation module, do the following.

1. Double click the NetBeans executable file, netbeans-7.3.1-windows.exe.

2. When the NetBeans Installer starts, follow the prompts.

Note: Setting the PATH may require using a Windows short name. To see top-level Windows short names, type C:\>dir /x

Note: If you are installing Oracle Java ME SDK for the first time, skip to Step 2.

Page 11: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Installing and Starting the Eclipse IDE

Before You Begin 1-3

When the installation is complete, NetBeans creates a shortcut on your desktop.

3. Double click the NetBeans IDE 7.3.1 shortcut to launch NetBeans.

Figure 1–1 The NetBeans Start Screen

For more information on working with the NetBeans IDE, see "Using the Oracle Java ME SDK Software with NetBeans."

Installing and Starting the Eclipse IDEIf you do not already have Eclipse Indigo 3.7 installed on your system, you can download it here:

http://www.eclipse.org/downloads/packages/release/indigo/sr2

You can download Juno 4.2 here:

Note: Oracle Java ME SDK 3.4 also supports NetBeans 7.4 Beta. However, its use is not described in this guide.

Page 12: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Installing and Starting the Eclipse IDE

1-4 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

http://www.eclipse.org/downloads/packages/release/juno/sr1

You can download Kepler 4.3 here:

http://www.eclipse.org/downloads

Once you have downloaded the Eclipse Kepler 4.3 executable, eclipse-java-kepler-ga-offline-installer-windows.exe, double-click -it to start running and follow the prompts.

For the Eclipse Indigo 3.7 or Juno 4.2 installation modules, do the following to install Eclipse on your system:

1. In the C:\Program Files directory, unzip the Eclipse distribution zip file.

2. In the C:\Program Files\eclipse directory, click eclipse.exe to launch Eclipse.

3. When the Select a Workspace dialog box appears, specify a directory location in which to store your Eclipse project files. Click OK.

Figure 1–2 The Eclipse Workspace Launcher

This opens the Eclipse main screen, as shown in Figure 1–3.

Note: For Eclipse Kepler, you must also specify a directory location in which to store your Eclipse project files, as shown in Step 3, below.

Note: Eclipse Kepler 4.3 is similar to Juno 4.2 and Eclipse 3.7. The instructions you see for those versions in this guide also apply to Kepler 4.3.

Page 13: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Installing and Starting the Eclipse IDE

Before You Begin 1-5

Figure 1–3 The Eclipse Start Screen

4. Click the icon on the far right (it says "Workbench"). This displays an empty workbench screen, as shown in Figure 1–4.

Page 14: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Verifying the UART Prefix

1-6 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Figure 1–4 The Eclipse Workbench Start Screen

For more information on working with the Eclipse IDE, see "Using the Oracle Java ME SDK Software with Eclipse."

Verifying the UART PrefixLastly, verify that the deviceaccess.uart.prefix property in the jwc_properties.ini file contains a prefix that will make it easy to convert the UARTConfig.portNumber value to a platform-specific port name. This is used for COM port discovering.

In the Win32 environment, the property should be set to COM so that appending a port number maps correctly to the proper port name. Add the following line to the jwc_properties.ini file:

deviceaccess.uart.prefix=COM

The jwc_properties.ini file is found in the following location:

C:\Java_ME_platform_SDK\3.4\runtimes\impng\bin

Note: If you are planning to work only in emulation, you can skip this step.

Page 15: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

2

Using the Oracle Java ME SDK Software with NetBeans 2-1

2Using the Oracle Java ME SDK Software withNetBeans

This chapter describes the NetBeans integrated development environment. NetBeans provides a rich, visual environment for developing embedded applications and numerous tools to improve the programming process.

Oracle Java ME SDK provides two plugins for working with NetBeans:

■ Java ME SDK Tools plugin

■ Java ME SDK Demos plugin

The Java ME SDK Demos plugin is optional, but recommended.

Downloading Oracle Java ME SDK Plugins To download the Oracle Java ME SDK Plugins file for NetBeans (oracle-jmesdk-3-4-rr-nb-plugins.zip) go to the following location:

http://www.oracle.com/technetwork/java/javame/javamobile/download/sdk

Installing Oracle Java ME SDK PluginsThere are two ways to install the Oracle Java ME SDK Plugins:

■ "Installing Plugins Using the Update Center"

■ "Installing NetBeans Plugins Manually"

To get the plugins ready for installation, start NetBeans as described in Chapter 1

Installing Plugins Using the Update CenterTo install the NetBeans Plugins using the NetBeans Update Center:

1. Select Tools > Plugins to open the NetBeans Plugins manager, as shown in Figure 2–1.

Note: Using the NetBeans Update Center to install the plugins is recommended. However, installing the plugins manually also works.

Page 16: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Installing Oracle Java ME SDK Plugins

2-2 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Figure 2–1 The NetBeans Plugin Manager

2. Click the Settings tab. This displays the available update centers, as shown in Figure 2–2.

Page 17: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Installing Oracle Java ME SDK Plugins

Using the Oracle Java ME SDK Software with NetBeans 2-3

Figure 2–2 Adding a Plugin Portal

3. Click the Add button. In the new window, type a provider name and a URL for the location that contains the plugin center files, as shown in Figure 2–3.

Figure 2–3 Creating a New Update Center

4. When plugins are detected, they are displayed on the Available Plugins tab. If you do not see them, click the Check for Newest button.

■ Locate the Oracle Java ME SDK plugins.

■ In the Install column check the desired plugins, then click the Install button.

Page 18: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Installing Oracle Java ME SDK Plugins

2-4 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Figure 2–4 The Oracle Java ME SDK Plugins

5. Restart NetBeans.

6. In the Plugins Manager Settings tab, enable all available update centers.

7. In the Installed tab, check Show details (above the plugin list) and sort by category to easily find the Java ME SDK Tools plugins.

■ Make sure the plugins you installed are active (with a green check mark), as shown in Figure 2–5.

■ If the Oracle Java ME SDK plugins are not Active, check the Select boxes for the plugins and click Activate.

Figure 2–5 The Plugins Manager Installed Tab

The Oracle Java ME SDK is ready to use. For more information on how to verify your plugin installation, see "Verifying Your Installation."

Installing NetBeans Plugins ManuallyTo install the NetBeans Plugins manually.

1. Extract the contents of the NetBeans Plugins file to a directory on your local machine. Make note of the location.

2. Open the NetBeans Plugins Manager. Select:

Tools > Plugins

3. Uninstall previous plugins.

■ Go to the Installed tab and click Show details, as shown in Figure 2–6.

■ Check Java ME SDK Tools and Java ME SDK Demos.

Note: If the previous plugins have already been uninstalled, go to Step 6.

Page 19: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Installing Oracle Java ME SDK Plugins

Using the Oracle Java ME SDK Software with NetBeans 2-5

Figure 2–6 NetBeans Plugins Manager Window

■ Click Uninstall.

■ Restart when requested.

4. Re-open the Plugins Manager and click the Downloaded tab, as shown in Figure 2–7.

5. Click the Add Plugins button.

Figure 2–7 The Downloaded Tab and Add Plugins Button

6. In the file browser, go to the directory in which you have extracted the contents of the NetBeans Plugins.

7. Select all the .nbm files and click Open, as shown in Figure 2–8.

Page 20: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Installing Oracle Java ME SDK Plugins

2-6 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Figure 2–8 Adding Plugins

8. Go to the Downloaded tab and select all downloaded plugins, as shown in Figure 2–9, and click Install.

Figure 2–9 Selecting Downloaded Plugins

Page 21: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Installing Oracle Java ME SDK Plugins

Using the Oracle Java ME SDK Software with NetBeans 2-7

9. When the NetBeans IDE Installer screen is displayed, as shown in Figure 2–10, click Next.

■ Accept the license terms and click Install.

■ If additional Validation screens appear, click Continue.

Figure 2–10 The NetBeans IDE Installer

10. Click Finish to restart NetBeans.

11. Select Tools > Plugins to display the Plugins screen.

12. In the Installed tab, check Show details and click Category to sort the plugins.

■ Find the Java ME SDK Tools and Java ME SDK Demos plugins in the list.

■ Make sure the plugins you installed are Active (you should see a green check mark), as shown in Figure 2–6.

■ If the Oracle Java ME SDK plugins are not Active, check the Select boxes for the plugins and click Activate.

13. When your Oracle Java ME SDK plugins are Active, click Close.

The Oracle Java ME SDK is ready to use. For more information on how to verify your plugin installation, see "Verifying Your Installation."

Page 22: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Verifying Your Installation

2-8 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Verifying Your InstallationOnce you have installed the Oracle Java ME SDK Plugins into NetBeans (using the Update Center or by manual installation), the Oracle Java ME SDK platform is installed into the NetBeans IDE. To verify a successful installation, do the following:

1. To view available Oracle Java ME SDK 3.4 devices, select Tools > Java ME > Device Selector. The ME SDK devices are listed, as shown in Figure 2–11.

Figure 2–11 The Device Selector

2. To display the new Oracle Java ME SDK platform, choose Tools > Java Platforms. This displays the Java Platform Manager with the new platform, as shown in Figure 2–12.

Page 23: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Creating a Sample IMlet File

Using the Oracle Java ME SDK Software with NetBeans 2-9

Figure 2–12 The Java Platform Manager

The Oracle ME SDK Platform is now ready for you to work with, to create a new project and develop code, as shown in the following sections.

Creating a Sample IMlet FileIn this section, you create a sample IMlet file, IMletDemo.java, from the code provided in Example 2–1. This IMlet file is used in the next section, "Creating a New Project".

1. Copy the code shown in Example 2–1 into a text file. Use Notepad rather than WordPad, to avoid any unneeded extra characters.

2. Name the file IMletDemo.java and Save. Set the file aside for now.

Example 2–1 Code for the Sample IMletDemo.java Project in NetBeans

package imletdemo;import javax.microedition.midlet.MIDlet;

public class IMletDemo extends MIDlet {

boolean bFirst = false; boolean loopFlag = true;

public void startApp() {

if (bFirst = false) {

try { // Perform startup operations } catch (Exception ex) {

Page 24: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Creating a New Project

2-10 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

ex.printStackTrace(); return; }

bFirst = true; } else { System.out.println("IMlet Demo is already started..."); }

// Start program here

}

public void pauseApp() { // Pause the application }

public void destroyApp(boolean unconditional) { bFirst = false;

// Close all resources that have been opened

}

}

Creating a New ProjectThis section walks you through creating a new embedded project using the Oracle Java ME SDK and NetBeans platforms.

1. Choose File > New Project. The New Project dialog box appears.

2. Choose Java ME from the Categories list and Embedded Application from the Projects list, as shown in Figure 2–13.

Page 25: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Creating a New Project

Using the Oracle Java ME SDK Software with NetBeans 2-11

Figure 2–13 The New Project Screen

3. Press the Next button. This shows the The New Embedded Application dialog box, with EmbeddedApplication1 in the Name and Location panel.

4. Enter IMletDemo as the Project Name.

5. Accept the default Project Location or browse to select it. Ensure that the Create Default Package and IMlet Class option is checked, as shown in Figure 2–14. Click Next.

Page 26: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Creating a New Project

2-12 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Figure 2–14 Creating a New Project

6. The Default Platform Selection is displayed. In the Emulator Platform box, choose "Oracle Java(TM) Platform Micro Edition 3.4." Choose "IMPNGDevice1" for the Device, "CLDC 1.1" for the Device Configuration, and "IMP-NG" for the Device Profile, as shown in Figure 2–15. Press Finish.

Page 27: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Creating a New Project

Using the Oracle Java ME SDK Software with NetBeans 2-13

Figure 2–15 Setting the New Default Platform

7. The NetBeans New Project screen is displayed for the project you have just created, containing default minimal sample code, as shown in Figure 2–16.

Page 28: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Including Your Sample IMlet Code

2-14 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Figure 2–16 The New IMletDemo Project

Including Your Sample IMlet CodeNow you can update the generic project with the sample code you created earlier in "Creating a Sample IMlet File." The NetBeans Projects window looks like Figure 2–17.

Page 29: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Including Your Sample IMlet Code

Using the Oracle Java ME SDK Software with NetBeans 2-15

Figure 2–17 The IMletDemo Project Tree

1. Right click to select IMlet.java in the Projects window.

2. Select Refactor --> Rename to display the Rename Class IMlet dialog box.

3. In the Rename Class IMlet dialog box, enter IMletDemo. Ensure that Apply Rename on Comments is checked, as shown in Figure 2–18. Press Refactor.

Figure 2–18 The Rename Class IMlet Dialog Box

4. This changes the name in the Projects window to IMletDemo.java, as shown in Figure 2–19. Right click IMletDemo.java and select Properties.

Page 30: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Including Your Sample IMlet Code

2-16 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Figure 2–19 The IMletDemo Projects Window

5. This displays the IMletDemo.java - Properties window. To see the path to the location of the newly-refactored IMletDemo.java file, look in the All Files line. Make a note of this path.

6. Take the IMletDemo.java file you created in "Creating a Sample IMlet File" and use it to overwrite the IMletDemo.java file in the path location you have just noted. When it asks you to confirm the File Replace, click Yes.

7. This changes the content of the NetBeans Project window to the content contained in the newly-added IMletDemo.java file, as shown in Figure 2–20. (If it does not double-click IMletDemo.java in the Projects window.

Page 31: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Including Your Sample IMlet Code

Using the Oracle Java ME SDK Software with NetBeans 2-17

Figure 2–20 The NetBeans Project Window with the IMletDemo Project

8. Clean and build the IMletDemo project by clicking on the hammer-and-broom icon in the NetBeans toolbar, as shown in Figure 2–21, or by selecting Run > Clean and Build Project (IMletDemo).

Figure 2–21 The NetBeans Toolbar and Menus

9. Run the newly cleaned and built IMletDemo project by selecting the green right-arrow icon in the NetBeans toolbar or by selecting Run > Run Project (IMletDemo).

When the Run is successful, the IMPNGDevice1 emulator starts with the IMletDemo Suite running, as shown in Figure 2–22.

Page 32: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Including Your Sample IMlet Code

2-18 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Figure 2–22 The NetBeans Emulator Window Running the IMletDemo Project

For more information about the emulator, see Chapter 3, "Using the Emulator".

Page 33: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

3

Using the Emulator 3-1

3Using the Emulator

The Oracle Java ME SDK emulation environment provides you with a platform for testing and running IMP-NG IMlet suites without having to install those IMlet suites onto an embedded device. This chapter describes running the emulation environment.

This chapter continues from Chapter 2, "Using the Oracle Java ME SDK Software with NetBeans." For the Eclipse IDE, some small differences may appear. On the whole, the descriptions of the emulator for the NetBeans IDE map closely to the emulator for the Eclipse IDE.

The Oracle Java ME SDK emulator can also be started from the Windows command line and can be run without starting either NetBeans or Eclipse. For more information on using the emulator from the command line, see Appendix B, "Using the Command Line Emulator."

The Emulator’s Main Screen The Oracle Java ME SDK emulator provides several ways to interact with an emulated device (for example, the IMPNGDevice1), as shown in Figure 3–1.

■ The Application menu (and associated icons) allow you to install and run IMlet suites.

■ The Tools menu allows you to manage a Landmark Store or file system.

■ The External Events Generator icon (and Tools menu option) allows you to configure pins, ports, interfaces, and other customizable parts.

■ The View menu allows you to display log information and other output in a console window.

■ The Help menu allows you to display context-sensitive help to get more information about the emulator screen and functions.

Figure 3–1 The Oracle Java ME SDK Emulator Toolbar and Menu Items

When the Oracle Java ME SDK emulator starts, it appears with the Application Management System (AMS) tab selected as the default, as shown in Figure 3–2.

Page 34: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

The Emulator’s Main Screen

3-2 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Figure 3–2 The Oracle Java ME SDK Emulator (AMS Tab) Default Screen

The AMS TabThe first tab in the emulator, the AMS tab, displays which Oracle Java ME SDK applications are installed, including those that are currently running or stopped.

You can use the buttons in the AMS tab, as shown in Figure 3–3, to do the following:

■ Install or update additional applications

■ Obtain information about a currently-selected application

■ Start, Stop, or Suspend an application

■ Remove (uninstall) an application from the AMS

Page 35: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

The Emulator’s Main Screen

Using the Emulator 3-3

Figure 3–3 Buttons on the AMS Tab

The GPIO Pins TabThe GPIO tab lists the emulator’s current General Purpose I/O (GPIO) pins and their directional state (output). For GPIO pins, the current value is shown as low or high. The GPIO Pins tab is shown in Figure 3–4:

Figure 3–4 The Emulator GPIO Pins Tab

The GPIO Ports TabFor GPIO ports, the port ID and port Name is shown, along with the port’s Maximum Value and current Value., as shown in Figure 3–5.

Page 36: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

The Emulator’s Main Screen

3-4 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Figure 3–5 The Emulator GPIO Ports Tab

The I2C TabThe Inter-Integrated Circuit (I2C) tab emulates a simple peripheral slave device that echoes back any data that is sent to it. Both the sent and received data are shown in their appropriate window panes, as shown in Figure 3–6:

Page 37: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

The Emulator’s Main Screen

Using the Emulator 3-5

Figure 3–6 The Emulator I2C Tab

The SPI TabThe Serial Peripheral Interface (SPI) tab is similar to the I2C tab. It emulates a simple peripheral slave device that echoes back any data that is sent to it. Both the sent and received data are shown in their appropriate tabs, as shown in Figure 3–7:

Page 38: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

The Emulator’s Main Screen

3-6 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Figure 3–7 The Emulator SPI Tab

The MMIO TabThe MMIO tab emulates the Memory-Mapped I/O (MMIO) interface bus. The MMIO interface creates four separate devices that can be used for testing: TEST_DEVICE, WDOGLOG, RTC, and BIG_ENDIAN_DEVICE. Each type of device displays its appropriate block configuration in an information table, as shown in Figure 3–8:

Page 39: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

The Emulator’s Main Screen

Using the Emulator 3-7

Figure 3–8 The Emulator MMIO Tab

The ADC TabThe Audio-to-Digital Converter (ADC) tab displays current Channel information, such as ID, Converter Number, Minimum and Maximum Values, and Sampling Intervals, as shown in Figure 3–9.

Figure 3–9 The Emulator ADC Tab

Page 40: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

The Emulator’s Main Screen

3-8 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

The DAC TabThe Digital-to-Audio Converter (DAC) tab displays current Channel information, such as Minimum and Maximum Values, Sampling Interval, and Reference Voltage, as shown in Figure 3–10.

Figure 3–10 The Emulator DAC Tab

The Pulse Counters TabThe Pulse Counters tab allows you to send pulse information to as many as four counters. as shown in Figure 3–11. There are four kinds of pulses:

■ Falling Pulse Edge - Can only be bound to input pins with the Falling Edge trigger.

■ Rising Pulse Edge - Can only be bound to input pins with the Rising Edge trigger.

Page 41: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

The External Events Generator

Using the Emulator 3-9

■ Negative Pulse Edge - Can only be bound to input pins with the Both Edges trigger.

■ Positive Pulse Edge - Can only be bound to input pins with the Both Edges trigger.

Figure 3–11 The Emulator Pulse Counters Tab

The External Events GeneratorThe External Events Generator allows you to test the capabilities of your device by simulating events on that device. For example, you can send pulses to a pulse counter or define an access point for network connectivity.

The External Events Generator is started by clicking on the External Events Generator tab, as shown in Figure 3–1, or by selecting Tools --> External Events Generator.

When the External Events Generator is started the default tab is the Audio-to-Digital Converter tab, as shown in Figure 3–12.

Figure 3–12 The External Events Generator ADC Tab

The ADC TabThe Audio-to-Digital Converter (ADC) tab allows you to test audio input, as shown in Figure 3–12, including Channel, DAC Input, and minimum and maximum values.

The Access Points TabThe Access Points tab allows the user to configure the settings returned by various methods of the Access Point API, including Wi-Fi and carrier networks, as shown in Figure 3–13.

Page 42: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

The External Events Generator

3-10 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Figure 3–13 The External Events Generator Access Points Tab

The GPIO TabTo generate input events for General Purpose I/O (GPIO), select the GPIO menu item under the Device menu. This action raises the External Events Generator window. Here, you can toggle the value of each of the pins from high to low and vice versa, and use a wave generator to simulate a more complex signal to the emulator. The GPIO External Events Generator is shown in Figure 3–14.

Page 43: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

The External Events Generator

Using the Emulator 3-11

Figure 3–14 The External Events Generator GPIO Tab

The Location TabThe Location tab allows the device to specify the simulated Location Provider, Orientation, and other settings, such as Latitude, Longitude, Altitude, Speed, and Course, as shown in Figure 3–15.

Page 44: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

The External Events Generator

3-12 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Figure 3–15 The External Events Generator Location Tab

The MMIO TabThe MMIO tab of the External Events Generator allows the user to simulate sending input event IDs to one of the four different peripheral device types. This tab is shown in Figure 3–16.

Page 45: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Using the Device Manager

Using the Emulator 3-13

Figure 3–16 The External Events Generator MMIO Tab

The Pulse Counter TabThe Pulse Counter tab allows you to send a a sequence of pulses to as many as four pulse counters, as shown in Figure 3–17.

Figure 3–17 The External Events Generator Pulse Counters Tab

Using the Device ManagerThe Device Manager is started the first time the emulator is started. Its purpose is to manage multiple devices and device storage, so that multiple devices can be emulated without overwriting or colliding with each other. The list of registered devices is shown in Figure 3–18.

Note: The External Events Generator Mobile tab is not used by Embedded Applications so it is not documented here.

Note: The Oracle Java ME SDK supports many device types, but only two are used by Embedded Applications: IMPNGDevice1 and IMPNGDevice2.

Page 46: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Using the Device Manager

3-14 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Figure 3–18 A List of Registered Devices in the Device Manager

When the Device Manager is started, it stays running as an icon in your system tray. To interact with the Device Manager, right-click the icon to display the Device Manager menu.

The Device Manager also allows you to add the IP address of one or more additional devices using the Device Address Manager, as shown in Figure 3–19.

Figure 3–19 The Device Address Manager

Page 47: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

4

Using the Oracle Java ME SDK Software with Eclipse 4-1

4 Using the Oracle Java ME SDK Software withEclipse

Using the Eclipse integrated development environment, you can create and test embedded applications using a graphical development environment.

Installing the Oracle Java ME SDK Eclipse PluginThe Oracle Java ME SDK Plugins are the same for the Kepler 4.3, Juno 4.2, and Indigo 3.7 platforms.

To download the Oracle Java ME SDK Plugins file for Eclipse (oracle-jmesdk-3-4-rr-eclipse-plugins.zip), go to the following location:

http://www.oracle.com/technetwork/java/javame/javamobile/download/sdk

Installing Plugins on Eclipse Indigo 3.71. In Eclipse, go to Help > Install New Software. This displays the Available Software

screen, as shown in Figure 4–1.

Note: The examples in this chapter use the Eclipse Indigo 3.7 platform.

Page 48: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Installing the Oracle Java ME SDK Eclipse Plugin

4-2 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Figure 4–1 The Eclipse Available Software Screen

2. Press the Add button. This displays the Add Repository window.

3. In the Add Repository window, press the Archive button to open a file browser.

4. In the file browser, select the Eclipse plugin file that you downloaded. Click Open to return to the previous dialog.

5. The Add Repository window appears. Press OK.

6. The category Java ME SDK Tools appears in the Name area. Check the box in front of Java ME SDK Tools and ME SDK Demos as shown in Figure 4–2. Click Next.

Page 49: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Installing the Oracle Java ME SDK Eclipse Plugin

Using the Oracle Java ME SDK Software with Eclipse 4-3

Figure 4–2 Selecting Oracle Java ME SDK Plugins

7. The installation details are displayed. Press Next. The items you checked are listed, as shown in Figure 4–3. Press Next again.

Figure 4–3 Eclipse Plugins Installation Details

8. Accept the terms of the license agreement and click Finish.

9. Check the Java ME SDK Tools Category and its subcategories and press the Next button to start the Add wizard.

Page 50: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Installing the Oracle Java ME SDK Eclipse Plugin

4-4 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

10. Accept the terms of the license agreement and click Finish. The installation process starts.

11. When the installation process completes, restart Eclipse. The Eclipse Welcome Screen is displayed, as shown in Figure 4–4.

Figure 4–4 The Eclipse Welcome Screen

Installing Plugins on Eclipse Kepler 4.3 and Juno 4.2On Eclipse Kepler 4.3 and Juno 4.2, installing the Oracle Java ME SDK plugins requires the Eclipse Mobile Tools for Java (MTJ) toolkit. The MTJ is not bundled with Juno and must be installed manually, before installing the Eclipse plugins.

To install the Eclipse Mobile Tools for Java toolkit:

1. Go to Help > Install New Software.

2. In the “Work with” field, enter this URL:

http://download.eclipse.org/mtj/updates/1.1.2/stable/

3. Click Add.

When the plugins are discovered, open the Mobile and Device Development Tools hierarchy and check Mobile Tools for Java Examples and Mobile Tools for Java SDK. Click Next.

On the installation screen select all plugins and click Finish then click OK.

4. A Juno plugin named org.eclipse.jetty.server_<version>.jar conflicts with the MTJ libraries when the plugin version is higher than 6.

Page 51: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Configuring Eclipse

Using the Oracle Java ME SDK Software with Eclipse 4-5

If the org.eclipse.jetty.server version is higher than 6 you must prevent it from loading by changing its name so the JAR file is not parsed. Locate the file in the \plugins directory of your Juno installation and change the extension from .jar to something else.

For example, change it to: org.eclipse.jetty.server_<version>.old

Configuring EclipseTo configure Eclipse, follow these steps:

1. Select Window > Open Perspective > Other and choose Java ME, as shown in Figure 4–5. Click OK.

Figure 4–5 Selecting Java ME for Configuration

2. Select Window > Preferences > and expand the Java ME node.

3. Select Device Management. The Device Management page displays a list of devices used by Oracle Java ME SDK projects.

4. Click the Manual Install... button, to the right of the Device Management screen.

5. In the Specify Search Directory field, enter or browse to the location of the Oracle Java ME SDK platform installation. For example:

C:\Java_ME_platform_SDK_3.4

Note: Once you have installed the MTJ toolkit for Eclipse Kepler 4.3 or Juno 4.2, the procedure for installing the Oracle Java ME SDK plugins is the same as for Eclipse Indigo 3.7. See "Installing Plugins on Eclipse Indigo 3.7".

Page 52: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Creating a Sample IMlet File

4-6 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

6. Click OK. When the five default emulators are detected, make sure all the devices are checked and click Finish.

7. Click OK to close the installation window.

This returns you to the Eclipse main window. The Oracle Java ME SDK is now ready to use.

Creating a Sample IMlet FileIn this section, you create a sample IMlet file, IMletDemo.java, from the code provided in Example 4–1. This IMlet file is used in the next section, "Creating a New Oracle Java ME SDK Project in Eclipse."

1. Copy the code shown in Example 4–1 into a text file. Use Notepad rather than WordPad, to avoid any unneeded extra characters.

2. Name the file IMletDemo.java and Save. Set the file aside for now.

Example 4–1 Code for the Sample IMletDemo.java Project in NetBeans

import javax.microedition.midlet.MIDlet;

public class IMletDemo extends MIDlet {

boolean bFirst = false; boolean loopFlag = true;

public void startApp() {

if (bFirst = false) {

try { // Perform startup operations } catch (Exception ex) { ex.printStackTrace(); return; }

bFirst = true; } else { System.out.println("IMlet Demo is already started..."); }

// Start program here

}

public void pauseApp() { // Pause the application }

public void destroyApp(boolean unconditional) { bFirst = false;

// Close all resources that have been opened

}

Page 53: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Creating a New Oracle Java ME SDK Project in Eclipse

Using the Oracle Java ME SDK Software with Eclipse 4-7

}

Creating a New Oracle Java ME SDK Project in EclipseFollow the steps below to create a new Oracle Java ME SDK project in the Eclipse IDE:

1. Choose the File >New >Project > Java ME > Midlet Project menu item and click Next.

2. When the Create a MIDlet Project window appears, enter a Project Name (for example, IMletDemo).

3. To the right of the Configurations window, press the Add... button to add a configuration. This displays the Add Configuration dialog box, with no configurations.

4. In the Add Configuration dialog box, select "Oracle Java(TM) Platform Micro Edition SDK 3.4" from the drop-down menu in the SDK field. In the Device field, select "IMPNGDevice1."

5. Press Finish. This displays the New MIDlet Project window again, with IMPNGDevice1 selected as the Active Configuration.

6. Press Next. This displays the MIDlet Project Content dialog box, as shown in Figure 4–6.

The MIDlet Project Content dialog box allows you to create an Application Descriptor for your new project.

7. In the MIDlet Project Content dialog box, set the following fields as shown here:

■ Microedition Configuration: Connected Limited Device Configuration (1.1)

■ Microedition Profile: Information Module Profile (NG)

Page 54: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Creating a New Oracle Java ME SDK Project in Eclipse

4-8 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Figure 4–6 Creating A New Application Descriptor

8. Press Finish to create the new IMletDemo project.

Your new Eclipse project is ready to be run, as shown in Figure 4–7.

Page 55: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Creating a New Oracle Java ME SDK Project in Eclipse

Using the Oracle Java ME SDK Software with Eclipse 4-9

Figure 4–7 The New IMletDemo Project Overview

Configuring the Application DescriptorWith the IMletDemo project displayed in the Overview window of the Eclipse workscreen, do the following:

1. Click the Application Descriptor tab to display the contents of the Application Descriptor.

2. Change the MicroEdition-Profile property to IMP-NG, as shown in Figure 4–8.

Page 56: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Creating a New Oracle Java ME SDK Project in Eclipse

4-10 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Figure 4–8 Configuring the Application Descriptor

3. Click the Application Descriptor in the Pack window, as shown in Figure 4–9.

4. Press Control-S to save your changes.

Figure 4–9 Saving Changes to the Application Descriptor

Page 57: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Creating a New Oracle Java ME SDK Project in Eclipse

Using the Oracle Java ME SDK Software with Eclipse 4-11

Adding a Test MIDlet to the ProjectAdding a Test MIDlet to Eclipse allows to you set up sample code, from which you can easily launch your own project. To add a test MIDlet to Eclipse:

1. Select File > New > Java ME MIDlet.

2. Enter the name and optional package of the MIDlet, as shown in Figure 4–10.

Figure 4–10 Creating a New Java MIDlet

3. Press Finish. This creates the IMletDemo test MIDlet and displays Eclipse default code, as shown in Figure 4–11.

Page 58: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Creating a New Oracle Java ME SDK Project in Eclipse

4-12 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Figure 4–11 Displaying the IMletDemo Test MIDlet Sample Code

Adding Sample Code to a New ProjectYou have just created a new Oracle Java ME Embedded project as a test MIDlet in Eclipse. At this point, you can use the skeleton code provided in "Creating a Sample IMlet File" to start building an embedded project.

1. Select and delete the default code displayed in your new Eclipse project window.

2. Copy and paste the sample code you created in "Creating a Sample IMlet File" into the Eclipse project window.

3. Select IMletDemo.java in the Package Explorer window.

4. Press Control-S to save the new IMletDemo.java code in the Eclipse workscreen.

Figure 4–12 shows the Eclipse IDE window with the new project sample code incorporated.

Page 59: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Creating a New Oracle Java ME SDK Project in Eclipse

Using the Oracle Java ME SDK Software with Eclipse 4-13

Figure 4–12 The IMletDemo Sample Project Code

Running the IMletDemo Sample ProjectTo run the IMletDemo sample code:

1. With IMletDemo.java selected, press Control-F11.

This runs the sample code and launches the IMPNGDevice1 emulator, with the IMletDemo MIDlet Suite running, as shown in Figure 4–13.

For more information on working with the Oracle Java ME SDK emulator, see Chapter 3.

Page 60: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Creating a New Oracle Java ME SDK Project in Eclipse

4-14 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Figure 4–13 The IMPNGDevice1 Emulator with the IMLetDemo Running

Page 61: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

A

Running Sample Applications A-1

ARunning Sample Applications

This section describes how to use demos in the Oracle Java ME SDK platform. Because IMP-NG is headless, you can observe the running status of an application in the following ways:

■ In the emulator’s External Events Generator

■ In the Windows command line console

Sample applications are available in two ways:

■ As part of the Oracle Java ME SDK Plugins for each IDE (that is, for NetBeans and Eclipse)

■ By downloading from the Oracle Java ME SDK Update Center

Using the Oracle Java ME SDK Update Center to Get Sample ApplicationsThe Oracle Java ME SDK Update Center is a part of the Oracle Java ME SDK product distribution and is used only for updating Oracle Java ME SDK components.

To run the Oracle Java ME SDK Update Center:

1. Go to the location where you have installed the Oracle Java ME SDK distribution. For example, C:\Java_ME_platform_SDK_3.4.

2. Change to the \bin directory and double click on update-center.exe to launch the Oracle Java ME SDK Update Center.

3. Click on the Available and Updates tabs to find Samples (or to find other Oracle Java ME SDK software updates, such as new plugins.)

4. Select the Samples or updates you want to install and click Add.

Using Sample Applications in the EmulatorThe Oracle Java ME SDK platform comes with a number of sample applications. The following four demos best illustrate embedded features when run in Oracle Java ME SDK:

■ GPIODemo

Note: Before using the Oracle Java ME SDK demo applications, see "Installation and Runtime Security Guidelines" in Appendix C. Some demos use network access and open ports, and do not include protections against malicious intrusion. If you choose to run the sample projects, you should ensure your environment is secure.

Page 62: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Using Sample Applications in the Emulator

A-2 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

■ I2CDemo

■ NetworkDemoIMPNG

■ PDAPDemoIMPNG

Starting Sample ApplicationsThere are two ways to start sample applications in Oracle Java ME SDK:

■ From the IMPNGDevice1 emulator:

1. Select Application --> Run IMlet Suite

2. Fill in the Run IMlet Suite dialog box and provide the Path or URL for the IMlet Suite, as shown in Figure A–1.

Figure A–1 The Run IMlet Suite Dialog Box

■ From the Windows command line. Enter the following:

emulator.exe -Xdevice:IMPNGDevice1 -Xdescriptor:C:\Java_ME_platform_SDK_3.4\apps\sample\<sample_demo_folder>\<sample_demo_name>.jad

For the four demos described in this chapter, all but GPIODemo can be started using both of the ways shown here.

The GPIODemo Sample ApplicationThe GPIODemo can be run on the Oracle Java ME SDK emulator, IMPNGDevice1:

Note: With the exception of the I2CDemo, the sample projects provided with the Oracle Java ME SDK release can be run on the emulator or on a real device.

Page 63: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Using Sample Applications in the Emulator

Running Sample Applications A-3

1. Launch the External Events Generator by selecting Tools > External Events Generator or clicking on the External Events Generator icon.

2. Click the GPIO tab. This displays the GPIO screen, as shown in Figure A–2.

Figure A–2 The External Events Generator GPIO Tab

The External Events Generator GPIO tab approximates actions on a device. Each button is a toggle that turns an LED on and off, changing the value of the corresponding Pin from High to Low, or Low to High.

When a button is clicked, information is written to the IMPNGDevice1 GPIO Pins tab. Changes in the value of a Button can be seen in the Output and Value columns for Buttons 1, 2, and 3, as shown in Figure A–3.

3. Click each button to change the value in the Output column of the GPIO Pins tab, in the IMPNGDevice1.

Page 64: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Using Sample Applications in the Emulator

A-4 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Figure A–3 The GPIO Pins Tab

Notice the following about Buttons 1, 2, and 3 in the IMPNGDevice1 GPIO Pins tab:

■ Button 1 corresponds to Hardware Port Number 0 and Hardware Pin Number 0. Button 1 has a Rising Edge Trigger.

■ Button 2 corresponds to Hardware Port Number 2 and Hardware Pin Number 13. Button 2 has a Falling Edge Trigger.

■ Button 3 corresponds to Hardware Port Number 6 and Hardware Pin Number 15. Button 3 has a Falling Edge Trigger.

For more information on Rising and Falling Edge Triggers, see "The Pulse Counter Tab."

The I2CDemo Sample ApplicationThis demo is designed to work with the IMP-NG runtime for Windows. It has no user interaction.

To launch the I2C demo, click the I2C tab in IMPNGDevice1.

Page 65: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Using Sample Applications in the Emulator

Running Sample Applications A-5

Figure A–4 The I2C Tab

This demo acquires a slave named I2C_JOYSTICK, writes data to the slave, and retrieves it. The demo is successful if the Sent Data and Received Data match.

The NetworkDemoIMPNG Sample ApplicationThe NetworkDemoIMPNG demo can be configured as a server or as a client by editing the application descriptor. You launch two instances of this demo, the first one acts as a server and the second one acts as a client. The client instance attempts to connect to the server instance and if the connection is successful they exchange a message.

1. Create two instance projects of the NetworkDemoIMPNG sample project.

2. Right click the first project and select Properties.

3. In the Platform category choose the device IMPNGDevice1. In the Application Description category set the value of the following property:

Oracle-Demo-Network-Mode:Server

4. Click OK.

5. Launch the first project. It opens on the emulator IMPNGDevice1 and waits for a connection. You should see messages like the following:

6. Right click the second project and select Properties.

7. In the Platform category choose the device IMPNGDevice2. In the Application Description category set the value of the following property:

Oracle-Demo-Network-Mode:Client

8. Click OK.

9. Launch the second project. It opens on the emulator IMPNGDevice2.

10. The client attempts to connect to the server. If successful, you see the following in the output tab of the first project (the server):

Waiting for connection on port 500[AMS-TRACE] MIDlet:NetworkDemoIMPNG status=2[AMS-TRACE] MIDlet:NetworkDemoIMPNG status=1Connection acceptedMessage received - Client messages

The output of the second project (the client) shows the following:

Page 66: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Using Sample Applications in the Emulator

A-6 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

[AMS-TRACE] MIDlet:NetworkDemoIMPNG status=2[AMS-TRACE] MIDlet:NetworkDemoIMPNG status=1Connected to server localhost on port 500Message received - Server string

The PDAPDemoIMPNG Sample ApplicationFollow these steps to run the PDADemoIMPNG demo on the IMPNGDevice1 emulator:

1. Create test files and directories inside the emulator’s file system:

Documents and Settings\<user>\javame-sdk\<version>\work\IMPNGDevice1\appdb\filesystem\root1

2. Right click the project and select Properties. In the Platform category choose the device IMPNGDevice1 and click OK.

3. Launch the project. It runs on IMPNGDevice1.

4. On the emulator menu, select Tools > File Connection to see a list of mounted file systems.

Figure A–5 The Manage File System Window

5. Open a terminal emulator and create a raw connection to localhost on port 5001. For example:

telnet localhost 5001

Page 67: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

The System Controller Sample Application

Running Sample Applications A-7

A command line opens where you can browse the emulator’s file system. You can use the following commands:

– cd <dir_name> - Change directory

– ls - List information about the files for the current directory

– new file <file_name> - Create a new file

– new dir <directory_name> - Create a new directory

– prop <file_name> - Show properties of a file

– rm <file_name> - Remove the file

– view <file_name> - View a file's content

The Light Tracker Sample ApplicationThe Light Tracker sample application is aimed at showing off funtionality on a embedded device, such as the Keil MCBSTM32F200 reference platform.

In this demo, a certain number of LEDs are turned on and turned off on the reference board, in a sequence that you can control. It makes use of the Device Access API and a GPIO Port to demonstrate its functionality. It requires connection of an ADC channel to an on-board potentiometer.

For more information on the setup of the Light Tracker sample application, see the LightTrackDemo readme.txt file, in the location where you have installed the Oracle Java ME SDK sample applications. For example:

C:\Documents and Settings\username\Java_ME_SDK\samples\LightTrackDemo

For more information on the Keil MCBSTM32F200 platform, see the Oracle Java ME Embedded Getting Started Guide for the Reference Platform (Keil).

The System Controller Sample Application The System Controller sample application is aimed at showing off functionality on a embedded device, such as the Keil MCBSTM32F200 reference platform.

The purpose of this demo is to control the lifecycle of IMlets on the reference platform. It makes use of the following functionalities:

■ Multitasking Virtual Machine (MVM)

■ IMlet auto-start

■ Application Management System (AMS) API

■ Logging API

■ Device Access API

■ General Purpose Input/Output (GPIO)

■ Watchdog timer

Note: The Telnet negotiation mode must be set to Passive. The negotiation mode can be set inside a Telnet client application (for example, PuTTY), by choosing Category > Connection > Telnet > Passive.

Page 68: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

The System Controller Sample Application

A-8 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

For more information on the setup of the System Controller sample application, see the SystemControllerDemo readme.txt file, in the location where you have installed the Oracle Java ME SDK sample applications. For example:

C:\Documents and Settings\username\Java_ME_SDK\samples\SystemControllerDemo

For more information on the Keil MCBSTM32F200 platform, see the Oracle Java ME Embedded Getting Started Guide for the Reference Platform (Keil).

Page 69: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

B

Using the Command Line Emulator B-1

BUsing the Command Line Emulator

The Oracle Java ME SDK 3.4 emulator can be started from a Windows command line. Once started, it runs and behaves the same as it does when started from the NetBeans or Eclipse IDE.

Starting the emulator from the Windows command line allows you a number of emulator options. For more information, see "Useful Command Line Emulator Commands".

Finding the Oracle Java ME SDK EmulatorYou can find the Oracle Java ME SDK command line emulator within the bin directory of the Oracle Java ME SDK 3.4 installation.

For example, if the Oracle Java ME SDK 3.4 is installed in C:\Java_ME_platform_SDK_3.4, then the emulator would be located at: C:\Java_ME_platform_SDK_3.4\bin\emulator.exe

Using the Oracle Java ME SDK EmulatorTo start the emulator from the Windows command line:

1. Open the Windows command line from the Start Menu, using Start > Run.

2. Change to the bin directory of the Oracle Java ME SDK 3.4 distribution:

C:\>cd Java_ME_platform_SDK_3.4\bin

3. Enter the following command, as shown here:

emulator.exe -Xdevice:IMPNGDevice1 -Xdescriptor:location_of_jad_file

For example:

emulator.exe -Xdevice:IMPNGDevice1 -Xdescriptor:C:\Java_ME_platform_SDK_3.4\apps\sample\sample_imlet.jad

Useful Command Line Emulator CommandsThis section provides a list of ME SDK emulator commands you may find useful, which can be entered on the Windows command line.

Note: You can run the emulator command without the .exe extension. It works both ways, with the extension and without

Page 70: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Useful Command Line Emulator Commands

B-2 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

■ To show a list of installed IMlets, use the -Xjam:list subcommand:

EmulatorDir>emulator -Xjam:list

■ To see a list of all supported devices, use the -Xquery subcommand:

EmulatorDir>emulator -Xquery

■ To install a JAD over the air (OTA) and execute a IMlet, use the -Xjam:install subcommand:

EmulatorDir>emulator -Xjam:install=<JAD_file_URL>

For example:

EmulatorDir>emulator -Xjam:install=http://www.appstore.com/TestJAD.jad

■ To run an installed IMlet, use the -Xjam:run subcommand:

EmulatorDir>emulator -Xjam:run=[storage_name | storage_number]

Provide either the storage name or storage number for the IMlet to run. You can get the storage name and storage number from the list of IMlets shown by the -Xjam:list subcommand.

■ To remove an installed IMlet, use the -Xjam:remove subcommand:

EmulatorDir>emulator -Xjam:remove=[storage_name | storage_number | all]

Provide either the storage name or storage number for the IMlet to remove. To remove all IMlets, use all. You can get the storage name and storage number from the list of IMlets shown by the -Xjam:list subcommand.

■ To install a JAD file, execute the IMlet locally, and remove the IMlet when completed, use the -Xdescriptor subcommand:

EmulatorDir>emulator -Xdescriptor:<JAD_file_name>

■ To set an IMlet's security domain, use the -Xdomain subcommand:

EmulatorDir>emulator -Xdomain:<domain_name>

■ To run in autotest mode, use the -Xautotest subcommand:

EmulatorDir>emulator -Xautotest:<JAD_file_URL>

For example:

EmulatorDir>emulator -Xautotest:http://127.0.0.1:8080/getNextApp.jad

Note: For a complete list of ME SDK emulator commands, type: emulator -help.

Page 71: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

C

Installation and Runtime Security Guidelines C-1

CInstallation and Runtime Security Guidelines

The Oracle Java ME Embedded requires an execution model that makes certain networked resources available for emulator execution. These required resources might include - but are not limited to - a variety of communication capabilities between Oracle Java ME SDK components.

During execution, the Oracle Java ME Embedded architecture can present an insecure operating environment to the platform’s installation file system, as well as its runtime environment. For this reason, it is critically important to observe the precautions outlined in these guidelines when installing and running the Oracle Java ME Embedded.

Maintaining Optimum Network SecurityTo maintain optimum network security, Oracle Java ME Embedded can be installed and run in a “closed” network operating environment, where the Oracle Java ME Embedded system is not connected directly to the Internet. Or, it can be connected to a secure company Intranet environment that can reduce unwanted exposure to malicious intrusion.

An example of an Oracle Java ME SDK requirement for an Internet connection is when wireless functionality requires a connection to the Internet to support communications with the wireless network infrastructure that is part of an Oracle Java ME SDK application execution process. Whether or not an Internet connection is required depends on the particular application running on Oracle Java ME Embedded. For example, some applications can use an HTTP connection.

In any case, if the Oracle Java ME Embedded is open to any network access you must observe the following precautions to protect valuable resources from malicious intrusion:

■ Installing the Oracle Java ME SDK Demos plugin is optional. Some sample projects use network access and open ports. Because the sample code does not include protection against malicious intrusion, you must ensure your environment is secure if you choose to install and run the sample projects.

■ Install the Oracle Java ME Embedded behind a secure firewall that strictly limits unauthorized network access to the Oracle Java ME Embedded file system and services. Limit access privileges to those that are required for Oracle Java ME

Note: the Oracle Java ME Embedded installation and runtime system is fundamentally a developer system. It is not designed to guard against any malicious attacks from outside intruders.

Page 72: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Maintaining Optimum Network Security

C-2 Oracle Java ME Embedded Getting Started Guide for the Windows Platform

Embedded usage while allowing all the bidirectional local network communications that are necessary for Oracle Java ME Embedded functionality. The firewall configuration must support these requirements to run the Oracle Java ME Embedded while also addressing them from a security standpoint.

■ Follow the principle of “least privilege” by assigning the minimum set of system access permissions required for installation and execution of the Oracle Java ME Embedded.

■ Do not store any data sensitive information on the same file system that is hosting the Oracle Java ME Embedded.

■ To maintain the maximum level of security, make sure the operating system patches are up-to-date on the Oracle Java ME Embedded host machine.

Page 73: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

CLDC

Glossary-1

Glossary

Access Point

A network-connectivity configuration that is predefined on a device. An access point can represent different network profiles for the same bearer type, or for different bearer types that may be available on a device, such as Wi-Fi or Bluetooth.

ADC

Analog-to-Digital Converter. A hardware device that converts analog signals (time and amplitude) into a stream of binary numbers that can be processed by a digital device.

AMS

Application Management System. The system functionality that completes tasks such as installing applications, updating applications, and managing applications between foreground and background.

APDU

Application Protocol Data Unit. A communication mechanism used by SIM Cards and smart cards to communicate with card reader software or a card reader device.

API

Application Programming Interface. A set of classes used by programmers to write applications that provide standard methods and interfaces and eliminate the need for programmers to reinvent commonly used code.

ARM

Advanced RISC Machine. A family of computer processors using reduced instruction set (RISC) CPU technology, developed by ARM Holdings. ARM is a licensable instruction set architecture (ISA) and is used in the majority of embedded platforms.

AT commands

A set of commands developed to facilitate modem communications, such as dialing, hanging up, and changing the parameters of a connection. Also known as the Hayes command set, AT means attention.

AXF

ARM Executable Format. An ARM executable image generated by ARM tools.

BIP

Bearer Independent Protocol. Allows an application on a SIM Card to establish a data channel with a terminal, and through the terminal, to a remote server on the network.

CDMA

Code Division Multiple Access. A mobile telephone network standard used primarily in the United States and Canada as an alternative to GSM.

CLDC

Connected Limited Device Configuration. A Java ME platform configuration for devices with limited memory and network connectivity. It uses a low-footprint Java

Page 74: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Configuration

Glossary-2

virtual machine such as the CLDC HotSpot Implementation, and several minimalist Java platform APIs for application services.

Configuration

Defines the minimum Java runtime environment (for example, the combination of a Java virtual machine and a core set of Java platform APIs) for a family of Java ME platform devices.

DAC

Digital-to-Analog Converter. A hardware device that converts a stream of binary numbers into an analog signal (time and amplitude), such as audio playback.

ETSI

European Telecommunications Standards Institute. An independent, non-profit group responsible for the standardization of information and communication technologies within Europe. Although based in Europe, it carries worldwide influence in the telecommunications industry.

GCF

Generic Connection Framework. A part of CLDC, it is a Java ME API consisting of a hierarchy of interfaces and classes to create connections (such as HTTP, datagram, or streams) and perform I/O.

GPIO

General Purpose Input/Output. Unassigned pins on an embedded platform that can be assigned or configured as needed by a developer.

GPIO Port

A group of GPIO pins (typically 8 pins) arranged in a group and treated as a single port.

GSM

Global System for Mobile Communications. A 3G mobile telephone network standard used widely in Europe, Asia, and other parts of the world.

HTTP

HyperText Transfer Protocol. The most commonly used Internet protocol, based on TCP/IP that is used to fetch documents and other hypertext objects from remote hosts.

HTTPS

Secure HyperText Transfer Protocol. A protocol for transferring encrypted hypertext data using Secure Socket Layer (SSL) technology.

ICCID

Integrated Circuit Card Identification. The unique serial number assigned to an individual SIM Card.

IMP-NG

Information Module Profile Next Generation. A profile for embedded (headless) devices, the IMP-NG specification (JSR 228) is a subset of MIDP 2.0 that leverages many of the APIs of MIDP 2.0, including the latest security and networking+, but does not include graphics and user interface APIs.

Page 75: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

JDTS

Glossary-3

IMEI

International Mobile Equipment Identifier. A number unique to every mobile phone. It is used by a GSM or UMTS network to identify valid devices and can be used to stop a stolen or blocked phone from accessing the network. It is usually printed inside the battery compartment of the phone.

IMlet

An application written for IMP-NG. An IMlet does not differ from MIDP 2.0 MIDlet, except by the fact that an IMlet cannot refer to MIDP classes that are not part of IMP-NG. An IMlet can only use the APIs defined by the IMP-NG and CLDC specifications.

IMlet Suite

A way of packaging one or more IMlets for easy distribution and use. Similar to a MIDlet suite, but for smaller applications running in an embedded environment.

IMSI

International Mobile Subscriber Identity. A unique number associated with all GSM and UMTS network mobile phone users. It is stored on the SIM Card inside a phone and is used to identify itself to the network.

I2C

Inter-Integrated Circuit. A multi-master, serial computer bus used to attach low-speed peripherals to an embedded platform

ISA

Instruction Set Architecture. The part of a computer’s architecture related to programming, including data type, addressing modes, interrupt and exception handling, I/O, and memory architecture, and native commands. Reduced instruction set computing (RISC) is one kind of instruction set architecture.

JAD file

Java Application Descriptor file. A file provided in a MIDlet or IMlet suite that contains attributes used by application management software (AMS) to manage the MIDlet or IMlet life cycle, and other application-specific attributes used by the MIDlet or IMlet suite itself.

JAR file

Java Archive file. A platform-independent file format that aggregates many files into one. Multiple applications written in the Java programming language and their required components (class files, images, sounds, and other resource files) can be bundled in a JAR file and provided as part of a MIDlet or IMlet suite.

JCP

Java Community Process. The global standards body guiding the development of the Java programming language.

JDTS

Java Device Test Suite. A set of Java programming language tests developed specifically for the wireless marketplace, providing targeted, standardized testing for CLDC and MIDP on small and handheld devices.

Page 76: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Java ME platform

Glossary-4

Java ME platform

Java Platform, Micro Edition. A group of specifications and technologies that pertain to running the Java platform on small devices, such as cell phones, pagers, set-top boxes, and embedded devices. More specifically, the Java ME platform consists of a configuration (such as CLDC) and a profile (such as MIDP or IMP-NG) tailored to a specific class of device.

JSR

Java Specification Request. A proposal for developing new Java platform technology, which is reviewed, developed, and finalized into a formal specification by the JCP program.

Java Virtual Machine

A software “execution engine” that safely and compatibly executes the byte codes in Java class files on a microprocessor.

KVM

A Java virtual machine designed to run in a small, limited memory device. The CLDC configuration was initially designed to run in a KVM.

LCDUI

Liquid Crystal Display User Interface. A user interface toolkit for interacting with Liquid Crystal Display (LCD) screens in small devices. More generally, a shorthand way of referring to the MIDP user interface APIs.

MIDlet

An application written for MIDP.

MIDlet suite

A way of packaging one or more MIDlets for easy distribution and use. Each MIDlet suite contains a Java application descriptor file (.jad), which lists the class names and files names for each MIDlet, and a Java Archive file (.jar), which contains the class files and resource files for each MIDlet.

MIDP

Mobile Information Device Profile. A specification for a Java ME platform profile, running on top of a CLDC configuration that provides APIs for application life cycle, user interface, networking, and persistent storage in small devices.

MSISDN

Mobile Station Integrated Services Digital Network. A number uniquely identifying a subscription in a GSM or UMTS mobile network. It is the telephone number to the SIM Card in a mobile phone and used for voice, FAX, SMS, and data services.

MVM

Multiple Virtual Machines. A software mode that can run more than one MIDlet or IMlet at a time.

Obfuscation

A technique used to complicate code by making it harder to understand when it is decompiled. Obfuscation makes it harder to reverse-engineer applications and therefore, steal them.

Page 77: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

RMS

Glossary-5

Optional Package

A set of Java ME platform APIs that provides additional functionality by extending the runtime capabilities of an existing configuration and profile.

Preemption

Taking a resource, such as the foreground, from another application.

Preverification

Due to limited memory and processing power on small devices, the process of verifying Java technology classes is split into two parts. The first part is preverification which is done off-device using the preverify tool. The second part, which is verification, occurs on the device at runtime.

Profile

A set of APIs added to a configuration to support specific uses of an embedded or mobile device. Along with its underlying configuration, a profile defines a complete and self-contained application environment.

Provisioning

A mechanism for providing services, data, or both to an embedded or mobile device over a network.

Pulse Counter

A hardware or software component that counts electronic pulses, or events, on a digital input line, for example, a GPIO pin.

Push Registry

The list of inbound connections, across which entities can push data. Each item in the list contains the URL (protocol, host, and port) for the connection, the entity permitted to push data through the connection, and the application that receives the connection.

RISC

Reduced Instruction Set Computing. A CPU design based on simplified instruction sets that provide higher performance and faster execution of individual instructions. The ARM architecture is based on RISC design principles.

RL-ARM

Real-Time Library. A group of tightly coupled libraries designed to solve the real-time and communication challenges of embedded systems based on ARM processor-based microcontroller devices.

RMI

Remote Method Invocation. A feature of Java SE technology that enables Java technology objects running in one virtual machine to seamlessly invoke objects running in another virtual machine.

RMS

Record Management System. A simple record-oriented database that enables an IMlet or MIDlet to persistently store information and retrieve it later. MIDlets can also use the RMS to share data.

Page 78: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

RTOS

Glossary-6

RTOS

Real-Time Operating System. An operating system designed to serve real-time application requests. It uses multi-tasking, an advanced scheduling algorithm, and minimal latency to prioritize and process data.

RTSP

Real Time Streaming Protocol. A network control protocol designed to control streaming media servers and media sessions.

RTX

The real-time operating system used on the Keil MCBSTM32F200 embedded platform.

SCWS

Smart Card Web Server. A web server embedded in a smart card (such as a SIM Card) that allows HTTP transactions with the card.

SD card

Secure Digital cards. A non-volatile memory card format for use in portable devices, such as mobile phones and digital cameras, and embedded systems. SD cards come in three different sizes, with several storage capacities and speeds.

SIM

Subscriber Identity Module. An integrated circuit embedded into a removable SIM card that securely stores the International Mobile Subscriber Identity (IMSI) and the related key used to identify and authenticate subscribers on mobile and embedded devices.

Slave Mode

Describes the relationship between a master and one or more devices in a Serial Peripheral Interface (SPI) bus arrangement. Data transmission in an SPI bus is initiated by the master device and received by one or more slave devices, which cannot initiate data transmissions on their own.

Smart Card

A card that stores and processes information through the electronic circuits embedded in silicon in the substrate of its body. Smart cards carry both processing power and information. A SIM Card is a special kind of smart card for use in a mobile device.

SMS

Short Message Service. A protocol allowing transmission of short text-based messages over a wireless network. SMS messaging is the most widely-used data application in the world.

SMSC

Short Message Service Center. The SMSC routes messages and regulates SMS traffic. When an SMS message is sent, it goes to an SMS center first, then gets forwarded to the destination. If the destination is unavailable (for example, the recipient embedded board is powered down), the message is stored in the SMSC until the recipient becomes available.

Page 79: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

URI

Glossary-7

SOAP

Simple Object Access Protocol. An XML-based protocol that enables objects of any type to communicate in a distributed environment. It is most commonly used to develop web services.

SPI

Serial Peripheral Interface. A synchronous bus commonly used in embedded systems that allows full-duplex communication between a master device and one or more slave devices.

SSL

Secure Sockets Layer. A protocol for transmitting data over the Internet using encryption and authentication, including the use of digital certificates and both public and private keys.

SVM

Single Virtual Machine. A software mode that can run only one MIDlet or IMlet at a time.

Task

At the platform level, each separate application that runs within a single Java virtual machine is called a task. The API used to instantiate each task is a stripped-down version of the Isolate API defined in JSR 121.

TCP/IP

Transmission Control Protocol/Internet Protocol. A fundamental Internet protocol that provides for reliable delivery of streams of data from one host to another.

Terminal Profile

Device characteristics of a terminal (mobile or embedded device) passed to the SIM Card along with the IMEI at SIM Card initialization. The terminal profile tells the SIM Card what values are supported by the device.

UART

Universal Asynchronous Receiver/Transmitter. A piece of computer hardware that translates data between serial and parallel formats. It is used to facilitate communication between different kinds of peripheral devices, input/output streams, and embedded systems, to ensure universal communication between devices.

UICC

Universal Integrated Circuit Card. The smart card used in mobile terminals in GSM and UMTS networks. The UICC ensures the integrity and security of personal data on the card.

UMTS

Universal Mobile Telecommunications System. A third-generation (3G) mobile communications technology. It utilizes the radio spectrum in a fundamentally different way than GSM.

URI

Uniform Resource Identifier. A compact string of characters used to identify or name an abstract or physical resource. A URI can be further classified as a uniform resource locator (URL), a uniform resource name (URN), or both.

Page 80: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

USAT

Glossary-8

USAT

Universal SIM Application Toolkit. A software development kit intended for 3G networks. It enables USIM to initiate actions that can be used for various value-added services, such as those required for banking and other privacy related applications.

USB

Universal Serial Bus. An industry standard that defines the cables, connectors, and protocols used in a bus for connection, communication, and power supply between computers and electronic devices, such as embedded platforms and mobile phones.

USIM

Universal Subscriber Identity Module. An updated version of a SIM designed for use over 3G networks. USIM is able to process small applications securely using better cryptographic authentication and stronger keys. Larger memory on USIM enables the addition of thousands of contact details including subscriber information, contact details, and other custom settings.

WAE

Wireless Application Environment. An application framework for small devices, which leverages other technologies, such as Wireless Application Protocol (WAP).

WAP

Wireless Application Protocol. A protocol for transmitting data between a server and a client (such as a cell phone or embedded device) over a wireless network. WAP in the wireless world is analogous to HTTP in the World Wide Web.

Watchdog Timer

A dedicated piece of hardware or software that watches an embedded system for a fault condition by continually polling for a response. If the system goes offline and no response is received, the watchdog timer initiates a reboot procedure or takes other steps to return the system to a running state.

WCDMA

Wideband Code Division Multiple Access. A detailed protocol that defines how a mobile phone communicates with the tower, how its signals are modulated, how datagrams are structured, and how system interfaces are specified.

WMA

Wireless Messaging API. A set of classes for sending and receiving Short Message Service (SMS) messages.

XML Schema

A set of rules to which an XML document must conform to be considered valid.

Page 81: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Index-1

Index

Aadding a test MIDlet, 4-11adding sample code, 4-12

Cconfiguring, 4-5creating a new project, 2-10, 4-7creating a sample file, 2-9, 4-6

DDevice Manager, 3-13device manager, 3-13

EEclipse, 4-5, 4-7, 4-11, 4-12Eclipse plugins, 4-1Emulator, 3-1emulator

commands, B-1starting, B-1

External Events Generator, 3-9

Iinstalling, 4-1installing Java SE, 1-1installing plugins, 2-1

JJava SE, installing, 1-1

NNetBeans, 2-1, 2-9, 2-10, 4-6

PPATH, 1-1

Page 82: Oracle® Java ME Embedded · Oracle® Java ME Embedded Getting Started Guide for the Windows Platform Release 3.4 E35132-03 September 2013 This book describes how to use Oracle Java

Index-2


Recommended