"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
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
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.
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