"hello world" - my first MIDlet is not working .......

Hi There,

I have downloaded J2ME toolkit recently and wrote a "hello world" MIDlet which is as follows

import javax.microedition.midlet.*;

import javax.microedition.lcdui.*;

public class HelloWorld extends MIDlet implements CommandListener

{

private Command cmd;

private Display display;

public HelloWorld()

{

display = Display.getDisplay( this );

cmd = new Command("Exit", Command.SCREEN, 1);

}

public void startApp()

{

TextBox t = new TextBox( "Hello ", "Ravi", 256, 0 );

t.addCommand( cmd );

t.setCommandListener( this );

display.setCurrent( t );

}

public void pauseApp()

{

}

public void destroyApp( boolean unconditional )

{

}

public void commandAction( Command c, Displayable s )

{

if( c == cmd )

{

destroyApp( false );

notifyDestroyed();

}

}

}

the code builds fine and when i run it it shows -

"Could not create icon com.sun.midp.midlet.Selector$MIDletInfo@8e597cUnable to create MIDlet ravi"

in my toolbar ................

can any tell me ..... how to set these icons........

thank you

ravi

[1277 byte] By [missilelock] at [2007-9-26 2:10:52]
# 1
Hi, I've tested the code which you posted. It works just fine on my computer.It can also execute properly. I believe that it could be other factors that cause it not to function properly.
axlrose82 at 2007-6-29 9:02:15 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2
Hi ravi,please look into the topic "Problems with Execution of MIDlets" in which I posted the solution on August 1st.All the best.
korlam at 2007-6-29 9:02:16 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3

Hi there,

I can successfully compiled these code and generated .JAD file. but when I try to convert inot PRC. It show me following error message:

File:E:\j2me_cldc\apps\HelloWorld\bin\HelloWorld.jad Result:Failed: The .JAR file corresponding to the .JAD file you want to convert is missing. Java Applications (MIDlets) are represented by both a .JAD and a .JAR file pair. Both the .JAD and .JAR must be present to convert the MIDlet to a .PRC file. Please make sure both the .JAD and the .JAR files are present.

How can I get aforementioned JAR file? Just pack the class file by myself or something else needed to be done additionally? Please give me a hand...

HeChangrun

HeChangrun at 2007-6-29 9:02:16 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4

Hi,

J2ME Toolkit generates automatically JAR file which contains classes and resources when you

compile the application. If not, (I don't have toolkit here just now but...) there's somewhere in

menu "generate jad file" or something like that, click that and magic has happen, jar file can be found from your applications directory.

fusetron at 2007-6-29 9:02:16 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 5

Thanks for your kind answer. Yes, by clicking menu->package..

the JAR file will be generated automatically.

My current problem is the PRC converter report JAD and JAR unmatching... :-(

Therefore, I have no way to generate PRC file for Palm.

Anyboby can help me to figure out that?

I believe this is a very typical question. Why is not contained in detail within FAQ somewhere?

Best regardds,

HeChangrun

HeChangrun at 2007-6-29 9:02:16 > top of Java-index,Java Mobility Forums,Java ME Technologies...