We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Set Netbeans and Eclipse up to run J2ME!!!!!!!!!!!!!!!!

idur
idur asked
on
Medium Priority
2,684 Views
Last Modified: 2012-05-04
Hello, I am a real nweby with J2ME and I installed the J@ME wireless tool kit in Netbeans 3.6 and in Eclipse 3.0M8, but when I try to compile a simple program they don´t find the libraries.
Eclipse says that the import of javax.microedition cannot be resolved for the import
import javax.microedition.midlet.*;
and Netbeans says
Startup.java [1:1] package javax.microedition.midlet does not exist
import javax.microedition.midlet.*;

I need a step by step configure for BOTH of them (Eclipse and Netbens) to include this libraries!!!

Thank you very much
Rudi
Comment
Watch Question

Commented:
If you have the J2ME Wireless Toolkit that can run standalone, try to compile a basic MIDlet to see if there are any problems with the microedition packages.

E.g.

import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;

public class HelloWorld extends MIDlet implements CommandListener
{
    private Form      mainScreen;
    private TextField inputTxt;

    private static final Command exitCmd = new Command("Exit", Command.EXIT, 1);

    public HelloWorld()
    {
        inputTxt   = new TextField("Text Input", "HelloWorld!!!", 255, TextField.ANY);
        mainScreen = new Form("HelloWorld");
        mainScreen.setCommandListener(this);
        mainScreen.addCommand(exitCmd);
        mainScreen.append(inputTxt);
    }

    protected void startApp()
    {
        Display.getDisplay(this).setCurrent(mainScreen);
    }

    protected void pauseApp() { }

    protected void destroyApp(boolean unconditional)
    {
        notifyDestroyed();
    }

    public void commandAction(Command e, Displayable d)
    {
        destroyApp(false);
    }
}

Cheers

-OBCT

Author

Commented:
I used Ktoolbar form Sun´s wireless toolkit and got the following messeges::


Creating project "exemplo"

Place Java source files in "C:\WTK21\apps\exemplo\src"

Place application resource files in "C:\WTK21\apps\exemplo\res"

Place application library files in "C:\WTK21\apps\exemplo\lib"

Settings updated

Project settings saved

Project settings saved

Building "exemplo"

Build complete

Running with storage root DefaultColorPhone

Unable to create MIDlet HelloWorld

java.lang.ClassNotFoundException: HelloWorld

      at com.sun.midp.midlet.MIDletState.createMIDlet(+14)

      at com.sun.midp.midlet.Selector.run(+22)

Commented:
Make sure all your class files for the application are in  C:\WTK21\apps\exemplo\src
It sounds like that's the cause of the exception.
Have a look through the WTK's help documentation for more information on how to compile, run and package an MIDlet.

Author

Commented:
For this example you told me to run, I just put the file HelloWorld.java in the src folder.... Is there any other class ???

Commented:
>Is there any other class ???

No, there isn't.
Once your *.java files are in the 'src' directory, you can click 'build' in the WTK and it will compile your application.
If there are no errors in the java file and the compiling has finished...click "run" and your MIDlet app will be emulated in a mobile phone emulator.

Author

Commented:
Well, that´s what I´ve done. I want now that Netbeans and Eclipse compile the j2me classes...
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
For using ANtenna with Netbeans you may find the discussion at http://jroller.com/page/debashish?anchor=using_antenna_with_netbeans helpful.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.