Steps to configure the EclipseME plugin:
- Got to "Window > Preferences > J2ME".
- Set the WTK Root to the root folder of your wireless toolkit installation.
- Under J2ME, select "Device Management".
- In this tab, click on "Import".
- Specify the wireless toolkit root folder again in the "Specify search directory" text box.
- Now, click "Refresh" which searches the directory for installed devices. (I'm using the Sun Wireless Toolkit 2.5)
- Import all the devices in the list & click "Finish".
- Select a default device and click "OK".
Now, make a new J2ME Midlet Suite whose JAD file should be changed to make CLDC version equal to 1.0 and the MIDP version to 2.0. Then make a J2ME Midlet which I named "HelloWorld", containing the following code:
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.TextBox;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class HelloWorld extends MIDlet {
private Display display = null;
private TextBox textBox = null;
public HelloWorld() {
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
}
protected void pauseApp() {
}
protected void startApp() throws MIDletStateChangeException {
display = Display.getDisplay(this);
textBox = new TextBox("Simple", "Hello World!", 100, 0);
display.setCurrent(textBox);
}
}
Right click on your project, go to "J2ME > Create Package". This will create a "deployed" folder which contains a .jad and .jar file.
You could now copy these files to your phone and then open the JAD file via your phone. It should launch the "HelloWorld!" app! :)
You can also make a new "Run" configuration to execute the jar file from the Sun Wireless Toolkit emulator. This can be done from the "Run > Run" menu by making a new configuration under "Wireless Toolkit Emulator". Once created you can launch it easily!
Some points to note:
- For the Emulator configuration choose the "Midlet" form of executable rather than the "Over the Air" option.
- When you make a new J2ME Midlet Suite, in the screen for Java Settings, if you see a "J2ME Library (failed to get library information)" do not worry cause once you click finish, that particular problem goes away.
2 comments:
When you make a new J2ME Midlet Suite, in the screen for Java Settings, if you see a "J2ME Library (failed to get library information)" do not worry cause once you click finish, that particular problem DOESN'T GO away
Hi i am a Spanish java learner. Any idea of why it doesn't it work?
email: estono
There few things you need to do:
1. Make sure you install Sun WTK.
2. In Eclipse, you need to configure the Device Management (under Window-->Preference) using WTK.
3. Chose a device from the WTK device list (under Project-->Properties J2ME tag).
Post a Comment