building HelloWorld and getting error...

Hey!I am new to J2ME and Wireless ToolKit.I have just started the sample codes.I compiled some codes and succeeded but some got the same errors.I am using WTK2.2. Can anybody help me?reply soon.

Here is the output shown by WTK when I tried to build HelloWorld code.

Project settings saved

Building"j2me"

C:\WTK22\apps\j2me\src\greeting\HelloWorld.java:6: greeting.HelloWorld is notabstract and does not overrideabstract method commandAction(javax.microedition.lcdui.Command,javax.microedition.lcdui.Displayable) in javax.microedition.lcdui.CommandListener

publicclass HelloWorldextends MIDletimplements CommandListener

^

1 error

com.sun.kvem.ktools.ExecutionException

Build failed

I am getting the same message while building for the RecordStore code.

[1047 byte] By [Momia] at [2007-11-27 6:58:43]
# 1
did you implement commandAction method?
suparenoa at 2007-7-12 18:49:13 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2

Hi,

You should override commandAction(command c, Displayable d) method if you implements CommandListener interface. So just override it. Thats all. If you create a RecordStore it won't throw this exception unless you extends or implements any abstract classes or imterfaces.

Regards,

Hadhi.

pissing_crowa at 2007-7-12 18:49:13 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3

Hi!

Thanks Hadhi and Superano for your quick reply.Anyways, here is the HelloWorld code.

package greeting;

import javax.microedition.midlet.*;

import javax.microedition.lcdui.*;

public class HelloWorld extends MIDlet implements CommandListener

{

private Display display;

private TextBox textbox;

private Command quitCommand;

public void startApp()

{

display=Display.getDisplay(this);

quitCommand=new Command("Quit",Command.SCREEN,1);

textbox=new TextBox("Hello World","My First Midlet",40,0);

textbox.addCommand(quitCommand);

textbox.setCommandListener(this);

display.setCurrent(textbox);

}

public void pauseApp()

{

}

public void destroyApp(boolean unconditional)

{

}

public void CommandAction(Command choice,Displayable displayable)

{

if(choice==quitCommand)

{

destroyApp(false);

notifyDestroyed();

}

}

}

and here is the RecordStore code..Both tends to produce the same kind of error.

import javax.microedition.rms.*;

import javax.microedition.midlet.*;

import javax.microedition.lcdui.*;

import java.io.*;

public class RecordStoreEg extends MIDlet implements CommandListener

{

private Display display;

private TextBox textbox;

private Command quitCommand;

public void startApp()

{

display=Display.getDisplay(this);

quitCommand=new Command("Quit",Command.SCREEN,1);

textbox=new TextBox("Hello World","My First Midlet",40,0);

textbox.addCommand(quitCommand);

textbox.setCommandListener(this);

display.setCurrent(textBox);

}

public void pauseApp()

{

}

public void destroyApp(boolean unconditional)

{

}

public void CommandAction(Command choice,Displayable displayable)

{

if(choice==quitCommand)

{

destroyApp(false);

notifyDestroyed();

}

}

}

I need an immediate reply...

Regards,

Momi

Momia at 2007-7-12 18:49:13 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4
commandAction not CommandActionMessage was edited by: supareno
suparenoa at 2007-7-12 18:49:13 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 5
Thanks Supareno!!I am feeling embarrassment on my stupid blunder...Anyhow, thanx again for help....regards,Momi
Momia at 2007-7-12 18:49:13 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 6

i am building the same code.

i have no problem in javac and preverify command

but when i;m trying to do the midp command there's error occured.

====================

D:\j2me\src\greeting>javac -d d:\j2me\tmp_classes -target 1.1 -bootclasspath d:\

j2me\midp2.0fcs\classes HelloWorld.java

D:\j2me\src\greeting>preverify -d d:\j2me\classes d:\j2me\tmp_classes

D:\j2me\src\greeting>midp -classpath d:\j2me\classes greeting.HelloWorld

Warning: could not open config file(D:\j2me\midp2.0fcs;\lib\internal.config): st

orageOpen(): No such file or directory, D:\j2me\midp2.0fcs;\lib\internal.config

Warning: could not open config file(D:\j2me\midp2.0fcs;\lib\system.config): stor

ageOpen(): No such file or directory, D:\j2me\midp2.0fcs;\lib\system.config

=====================

i've been googling for sometimes and find out some similar problems.

one of the solutions offered is to change MIDP_HOME variable from "D:\j2me\midp2.0fcs;" into "D:\j2me\midp2.0fcs" (without semicolon).

i have tried this. but it's not working.

i have followed the installation guide from the complete reference J2ME book. (page 48-50)

i am using :

C:\j2sdk1.4.2_01

D:\j2me\j2me_cldc

D:\j2me\midp2.0fcs

any respons and solutions offered are welcomed.

dn7812a at 2007-7-12 18:49:13 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 7
Hi dn!!!Why dont u use the WTK? its simple and easy to handle...Try this and u will see it on working.Momi.
Momia at 2007-7-12 18:49:13 > top of Java-index,Java Mobility Forums,Java ME Technologies...