Nokia has stopped offering its Developer's Suite, relying on other IDEs, including Eclipse. Meanwhile, Nokia changed its own development tools again and EclipseMe has also changed. This leaves most documentation irrelevant.
I want to know what does it take to make a simple Hello-World?
(I already found out myself, so this is a Q&A for other people to use)
A MIDlet is an application that uses the mobile information device profile (MIDP) for the Java Platform, Micro Edition (Java ME) environment.
Here's what's needed to make a simple hello world -
Here's an HelloWorld sample to test the configuration.
Note: It worked for me on WindowsXP. Also note: This should work for S60 as well. Just replace the S40 SDK in phase 3 with S60's.
Unless you need to do something Nokia-specific, I suggest avoiding the Nokia device definitions altogether. Develop for a generic device, then download your application to real, physical devices for final testing. The steps I suggest:
Download and install Sun's Wireless Toolkit.
Install EclipseME, using the method "installing via a downloaded archive".
Configure EclipseME. Choose a generic device, such as the "DefaultColorPhone" to develop on.
Create a new project "J2ME Midlet Suite"
Right-click on the project, and create a new Midlet "HelloWorld"
Enter the code, for example:
public HelloWorld() {
super();
myForm = new Form("Hello World!");
myForm.append( new StringItem(null, "Hello, world!"));
myForm.addCommand(new Command("Exit", Command.EXIT, 0));
myForm.setCommandListener(this);
}
protected void startApp() throws MIDletStateChangeException {
Display.getDisplay(this).setCurrent(myForm);
}
protected void pauseApp() {}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {}
public void commandAction(Command arg0, Displayable arg1) {
notifyDestroyed();
}
The most annoying issue with EclipseME for me was the "broken" debugger, which just wouldn't start. This is covered in docs, but it took me about an hour to find this tip when I first installed EclipseME, and another hour when I returned to JavaME development a year later, so I decided to share this piece of knowledge here, too.
If the debugger won't start,
After that, Eclipse should be able to connect to KVM and run a midlet with a debugger attached.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With