Hi I am trying to write a simple J2ME application, (I've only started learning it), and am getting the following error:

Unable to create MIDlet null
java.lang.NullPointerException
at com.sun.midp.midlet.MIDletState.createMIDlet(+29)
at com.sun.midp.midlet.Selector.run(+22)

I don't know what's wrong. Any suggestions would be greatfully received. My code is as follows:

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("HelloWorld", "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);
            //notifyDestroy();
        }
    }
}

Thanks, sweetchuck

Hey its working fine..in Wireless toolkit 2.2

Can u tell me in which version u r running....this project

else .. are u familiar with this tool kit r wat ??

i willl tell the procedure..

just create a new project in emulator..

give project name for that HelloWorld and MIDlet Class Name also HelloWorld

then save the settings

and after tat save ur coding in that HelloWorld's src folder....

then come back to emulator..

click open project select HelloWorld Project then build and run..the project its working fine

Hi yeah, I was using Sun's Wireless Toolkit 2.5 and I've gotten it working. Simplest of problems. I was writing my own jads for nothing!

Thanks, again,
Mr.Sweetchuck:cheesy:

Fine Mr.SweetChuk

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.