How to Configure Eclipse with the EclipseME plugin on a Windows Machine
Mobile Game Development
Overview
Once you have Eclipse 3.6 installed, follow these directions to configure it
with the EclipseME plugin to develop J2ME applications.
Make sure all required software is installed
-
Eclipse 3.6
If you need to install it, follow these instructions.
-
Java Wireless Toolkit 2.5.2 for CLDC
If you need to install it, follow
these instructions.
Install EclipseMe for Eclipse
Except where noted you can simply accept the defaults.
-
Log in to your regular user account
-
Start Eclipse.
-
Select Help → Install New Software...
- If you already have the required EclipseME plugin (check by going to
Help
→
Install new Software
and click on the link at "What is already installed")
you may skip ahead to Writing Your First Program below.
-
Click on the Add button and type in this url
http://www.eclipseme.org/updates/ and give it a name (e.g. EclipseME).
If you get an error that says "Duplicate locations",
click the Cancel button. Pull down the dropdown list to the right
of the "Work with" text field and select the "
EclipseME - http://www.eclipseme.org/updates/" option.
-
Check "EclipseME" in the main section of the window and click
the Next button. CLick the Next button if asked to review the items to be installed.
-
Click Finish, or accept the License agreement and click Finish.
-
Wait for a moment while it installs.
-
If a dialog box pops up giving a warning that you are installing
unsigned content, click OK to continue installing.
-
Answer "yes" to the "restart Eclipse?" question.
-
EclipseME is now installed!
Writing Your First J2ME application
-
Now that you have EclipseME installed, you might want to create a project.
-
To create a new project configured for J2ME, go to File →
New → Other (or click the New button in the upper left or
press Ctrl+N).
- Expand the J2ME folder.
- Select J2ME Midlet Suite.
- Enter the desired Project name and click the Next button.
-
At this point, if you have yet to initialize your virtual
wireless devices, it will prompt you to do so.
-
Initialize a virtual wireless device.
- Click the Manage Devices button.
- Click the Import button in the upper right corner.
-
Browse to your installation of Java Wireless Toolkit (my
default was C:\WTK2.5.2_01).
-
Click the Refresh button and wait while it finds your available
cell phone emulators.
- Click the Finish button.
- Select a default phone of your choice then click the OK button.
- Click the Finish button to create your project.
-
Normally, instead of initializing the phones, you will be given
the option to choose which one will be used for this project
(You can change it later by project properties →
J2ME).
-
To make a Midlet (like an applet, but for a phone), click on the
name of your project in the Package Explorer view, then go to
File → New → Other, and then choose J2ME
Midlet.
-
Within this project, feel free to write normal classes; however,
note that the library will be limited since you are
writing code for a mobile device.
-
Running/Debugging a MIDlet.
-
In order to properly debug a MIDlet, you must change some of
Eclipse's default debug settings. Instructions on how
to do so are available on the
Configuring EclipseME and Eclipse web page.
They are repeated here for your convenience.
- Select the Preferences menu item from
Eclipse's Window menu.
- Expand the Java item in the left pane
and click on the Debug entry.
- Ensure that both Suspend execution on
uncaught exceptions and Suspend execution on
compilation errors near the top of the
dialog are NOT checked.
- Increase the Debugger timeout near the
bottom of the dialog to at least 15000 ms.
- Click the OK button after making these changes.
-
To run/debug your MIDlet, follow these simple steps, which
are adopted from the instructions given on
EclipseMe's
website.
- Expand your project in the Package Explorer view.
- Expand the src folder and right click on
the main Java class that extends the MIDlet
class.
- Hover your mouse over the Run As/Debug
As context sensitive menu.
- Click on the Run As/ Debug As "Emulated
J2ME Midlet" option.
-
Information on available components and API documentation
-
API Documentation for the
MIDlet Class.
-
J2ME Tutorial, Part 2:
User Interfaces with MIDP 2.0
-
Sample projects
-
You can find example projects and components in the apps subfolder
of the Java Wireless Toolkit installation folder (default
C:\WTK2.5.2_01). You can run them by starting the Wireless
Toolkit (there should be a start menu shortcut for it) and opening
the respective project. See the
installation
instructions for the Java Wireless Toolkit.
Importing a J2ME project into Eclipse
In order to edit and run an existing project in Eclipse, it must first be imported into Eclipse. Follow these steps to import and run an existing project.
- Start Eclipse and Switch workspace to your desired workspace (File → Switch Workspace).
- Use these menu options to import the existing project:
File → Import → General (expand this option) → Exising Projects into WOrkspace.
- Browse to the parent directory that contains the existing Eclipse project.
- Click the OK button.
- Select Copy projects into workspace.
- Click the Finish button.
- Try to run the midlet. If you experience no problems, you are
through importing the project into Eclipse.
Otherwise, do the following to address any problem that surfaces.
- Right click on the project that you imported into Eclipse
(find it in the Package Explorer view of your workbench
---on the left hand side of the workbench).
- Click on Properties, then J2ME (on the left slide of the window).
Note: Do NOT expand the J2ME item.
- Click on Manage Devices (If Group and Device are both blank.)
- Click the Import button in the upper right corner.
-
Browse to your installation of Java Wireless Toolkit (my
default was C:\WTK2.5.2_01).
-
Click the Refresh button and wait while it finds your available
cell phone emulators.
- Click the Finish button.
- Select a default phone of your choice then click the OK button.
- Click the OK button.
- You should now be able to run your midlet.