|Oracle® Java Micro Edition Software Development Kit Developer's Guide
Release 3.3 for Eclipse on Windows
Using the Eclipse integrated development environment, you can create and test embedded applications using a graphical development environment.
The examples in this chapter use the Eclipse Indigo 3.7 platform.
The Oracle Java ME SDK Plugins are the same for both the Indigo 3.7 and Juno 4.2 platforms.
To download the Oracle Java ME SDK Plugins file for Eclipse (
oracle-jmesdk-3-3-rr-eclipse-plugins.zip), go to the following location:
In Eclipse, go to Help > Install New Software. This displays the Available Software screen, as shown in Figure 2-1.
Figure 2-1 The Eclipse Available Software Screen
Press the Add button. This displays the Add Repository window.
In the Add Repository window, press the Archive button to open a file browser.
In the file browser, select the Eclipse plugin file that you downloaded, as shown in Figure 2-2. Click Open to return to the previous dialog.
Figure 2-2 Selecting Eclipse Plugins
The Add Repository window appears as shown in Figure 2-3. Press OK.
Figure 2-3 The Add Repositiory Window with Eclipse Plugins
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 2-4. Click Next.
Figure 2-4 Selecting Oracle Java ME SDK Plugins
The installation details are displayed. Press Next. The items you checked are listed, as shown in Figure 2-5. Press Next again.
Figure 2-5 Eclipse Plugins Installation Details
Accept the terms of the license agreement and click Finish.
Check the Java ME SDK Tools Category and its subcategories and press the Next button to start the Add wizard.
Accept the terms of the license agreement and click Finish. The installation process starts.
When the installation process completes, restart Eclipse. The Eclipse Welcome Screen is displayed, as shown in Figure 2-6.
Figure 2-6 The Eclipse Welcome Screen
On Eclipse 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:
Go to Help > Install New Software.
In the “Work with” field, enter this URL:
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.
Uncheck the "Contact all update sites...." checkbox and click Next.
On the installation screen select all plugins and click Finish. Then click OK.
A Juno plugin named
org.eclipse.jetty.server_<version>.jar conflicts with the MTJ libraries when the plugin version is higher than 6.
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:
Once you have installed the MTJ toolkit for Eclipse 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".
To configure Eclipse, follow these steps:
Select Window > Open Perspective > Other and choose Java ME, as shown in Figure 2-7. Click OK.
Figure 2-7 Selecting Java ME for Configuration
Select Window > Preferences > and expand the Java ME node.
Select Device Management. The Device Management page displays a list of devices used by Oracle Java ME SDK projects, as shown in Figure 2-8.
Figure 2-8 The Device Management Screen
Click the Manual Install... button, to the right of the Device Management screen.
In the Specify Search Directory field, enter or browse to the location of the Oracle Java ME SDK platform installation. For example:
Click OK. When the five default emulators are detected, make sure all the devices are checked, as shown in Figure 2-9, and click Finish.
Figure 2-9 Manual Device Installation
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.
The outstanding feature of Oracle Java ME SDK is device emulation for the Connected LimitedDevice Configuration (CLDC). If the plugins are properly installed you see the Device Selector tab on the bottom left. If they are not visible, you can select Window > Show View > Device Selector.
The Oracle Java ME SDK has two components.
The Oracle Java ME SDK platform software installation includes the supported runtimes, emulation software, device configurations, supporting libraries, documentation (including Javadocs), the command line interface, and other utility executables. The default location of the ME SDK is:
The ME SDK provides two unique instances for most devices. For example, IMPNGDevice1 and IMPNGDevice2 are the same except for the device number and the phone number, so you can perform tests that require two devices (messaging, for example) without customization.
For more information, see Chapter 6, "Working With Devices."
If the Oracle Java ME SDK plugins are installed and you cannot see the Device Selector, you can add the Java ME SDK devices manually.
Select Window > Open Perspective > Other > Java ME and click OK.
Go to Window > Preferences > Java ME > Device Management and click on Manual Install.
In the Specify Search Directory field, insert the path to the Java ME SDK platform installation directory, and press Enter. The devices appear on the Devices table. Click on Finish and then click on OK. The Device Selector opens.
The following tips offer some hints for getting started as quickly as possible.
Access the documentation. The online help is the primary documentation for the Oracle Java ME SDK. Many windows and dialogs feature a help button that opens context-sensitive help in the help viewer. You can also type F1.
Click the Help menu and select Help Contents to open the Eclipse Online Help viewer. Remember to use the search capability to help you find topics.
Run sample projects. Running sample projects is a good way to become familiar with the SDK.
See "Running a Project" for a general overview of how to run a project.
See the Package Explorer window and the Navigator window for a visual overview of the logical and physical layout of a project. When viewing items in the tree, use the context menu (right-click) to see the available actions.
A project has a default device that is used when it is run from the toolbar by clicking the green arrow or going to the Run menu and choosing Run.
To see a project's default device, expand the project node and double-click the Application Descriptor subnode. The project's Overview tab opens in the central editing area. The Runtime table on the bottom right of the Application Descriptor panel lists devices (execution environments) for the current project. The checked device will be used when the project is run. You can easily add, modify, or remove a device.
To run an application on different devices without changing the default device, right-click a device in the Device Selector pane, then select Run Project and choose an open project.
The emulator is an independent process, and when it has started it is a separate process from the build process running in Eclipse. Stopping the build process or closing a project does not always affect the application running in the emulator. You must be sure to terminate the application (the emulator can remain open). See "Running a Project."