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

  1. Eclipse 3.6 

    If you need to install it, follow these instructions.

  2. 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.
  1. Log in to your regular user account
  2. Start Eclipse.
  3. Select Help → Install New Software...
  4. 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.
  5. 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. 
  6. 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.
  7. Click Finish, or accept the License agreement and click Finish.
  8. Wait for a moment while it installs.
  9. If a dialog box pops up giving a warning that you are installing unsigned content, click OK to continue installing.
  10. Answer "yes" to the "restart Eclipse?" question.
  11. EclipseME is now installed!

Writing Your First J2ME application

  1. Now that you have EclipseME installed, you might want to create a project.
    1. 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).
    2. Expand the J2ME folder.
    3. Select J2ME Midlet Suite.
    4. Enter the desired Project name and click the Next button.
    5. At this point, if you have yet to initialize your virtual wireless devices, it will prompt you to do so.
  2. Initialize a virtual wireless device.
    1. Click the Manage Devices button.
    2.  Click the Import button in the upper right corner.
    3.  Browse to your installation of Java Wireless Toolkit (my default was C:\WTK2.5.2_01).
    4. Click the Refresh button and wait while it finds your available cell phone emulators.
    5.  Click the Finish button.
    6. Select a default phone of your choice then click the OK button.
    7. Click the Finish button to create your project.
    8. 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).
    9. 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.
    10. 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.
  3. Running/Debugging a MIDlet.
    1. 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.
      1. Select the Preferences menu item from Eclipse's Window menu.
      2. Expand the Java item in the left pane and click on the Debug entry.
      3. Ensure that both Suspend execution on uncaught exceptions and Suspend execution on compilation errors near the top of the dialog are NOT checked.
      4. Increase the Debugger timeout near the bottom of the dialog to at least 15000 ms.
      5. Click the OK button after making these changes.
    2. To run/debug your MIDlet, follow these simple steps, which are adopted from the instructions given on EclipseMe's website.
      1. Expand your project in the Package Explorer view.
      2. Expand the src folder and right click on the main Java class that extends the MIDlet class.
      3. Hover your mouse over the Run As/Debug As context sensitive menu.
      4. Click on the Run As/ Debug As "Emulated J2ME Midlet" option. 
  4. Information on available components and API documentation
    1. API Documentation for the MIDlet Class.
    2. J2ME Tutorial, Part 2: User Interfaces with MIDP 2.0
  5. Sample projects

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.
  1. Start Eclipse and Switch workspace to your desired workspace (File → Switch Workspace).
  2. Use these menu options to import the existing project:
    File → Import → General (expand this option) → Exising Projects into WOrkspace.
  3. Browse to the parent directory that contains the existing Eclipse project.
  4. Click the OK button.
  5. Select Copy projects into workspace.
  6. Click the Finish button.
  7. 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.
    1. 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).
    2. Click on Properties, then J2ME (on the left slide of the window). Note: Do NOT expand the J2ME item.
    3. Click on Manage Devices (If Group and Device are both blank.)
    4.  Click the Import button in the upper right corner.
    5.  Browse to your installation of Java Wireless Toolkit (my default was C:\WTK2.5.2_01).
    6. Click the Refresh button and wait while it finds your available cell phone emulators.
    7.  Click the Finish button.
    8. Select a default phone of your choice then click the OK button.
    9. Click the OK button.
  8. You should now be able to run your midlet.