Jump to content
  • Advertisement
Sign in to follow this  
isiahil

J2me Error

This topic is 4440 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I wrote some MIDlets's that are super simple, basically HelloWorld. but when I run them I get this error. What do I need to fix? Unable to create MIDlet HelloMIDlet java.lang.IllegalAccessException at com.sun.midp.midlet.MIDletState.createMIDlet(+34) at com.sun.midp.midlet.Selector.run(+22) Execution completed. 928668 bytecodes executed 32 thread switches 893 classes in the system (including system classes) 4654 dynamic objects allocated (135236 bytes) 2 garbage collections (109388 bytes collected)

Share this post


Link to post
Share on other sites
Advertisement
Where is the .jad file located? I have the .jar but cant find the .jad.
Here is the code:


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

class HelloMIDlet
extends MIDlet
implements CommandListener {
private Form mMainForm;
public TextField textb;

public HelloMIDlet() {
textb = new TextField("HelloMIDlet:","Isiah",10,TextField.ANY);
mMainForm = new Form("HelloMIDlet");
mMainForm.append(new StringItem(null, "Hello, MIDP!"));
mMainForm.append(textb);
mMainForm.addCommand(new Command("Exit", Command.EXIT, 0));
mMainForm.setCommandListener(this);
}

public void startApp() {
Display.getDisplay(this).setCurrent(mMainForm);
}

public void pauseApp() {}

public void destroyApp(boolean unconditional) {}

public void commandAction(Command c, Displayable s) {
notifyDestroyed();
}
}

Share this post


Link to post
Share on other sites
Quote:
Original post by _nomad_
how did you know it was line 17 with the error above? i never figured it out.


I didn't, I was attempting to point out that there was no way anyone could solve the OP's problem without more code/details. My post is what I attempt to pass off as humour :-)

Back on topic, I dont see anything wrong with your code. Are you using some IDE to build your code? If not I suggest you try something like NetBeans as it will make your life a lot simpler.

The JAD file is a simple text file that contains meta-data about the JAR. Things like the name of the JAR, the size, the icon for the application and some other stuff. Its not essential while you are testing on an emulator. A google search for "lj2me JAD" should turn up a ton of information.

Alan

Share this post


Link to post
Share on other sites
This is just a guess, but it looks like the emulator is having some troubles starting up. I'd try to investigate things like not running with administrator privileges, trying to access files in directories you don't have permissions for, etc. It might also help trying to remove and reinstall the emulator.

shmoove

Share this post


Link to post
Share on other sites
When I ran it in the NetBean compilier it said these imports dont exist. How do I get the compilier to recongize the imports?

import javax.microedition.lcdui.*;

import javax.microedition.midlet.*;

Share this post


Link to post
Share on other sites
My apologies, I should have pointed out that to write J2ME apps in NetBeans you have to get the Mobility add on pack. Its available from the same page you downloaded NetBeans the first time. For what its worth, it really is worth getting something like NetBeans working, it will save you a ton of time and effort later on.

Alan

Share this post


Link to post
Share on other sites
I did download the mobility pack. When I open a template its seems to reconize the libraries, but when i go to file and open my file it says it the libraries don't exist.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
From my professional experience with J2ME, NetBeans is almost as horrible (It has huge memory leaks especially with large projects!! I've had it using almost 300MB or ram before) an invention as J2ME (the phones already are slow and have no heap, let alone throw something known to hog both of them on there!) Something like JCreator is free, but it is designed for J2SE. If you know what you are doing with Visual Studio .NET, you can use that to write and build your code (and even get all the features Outlining and Intellesense for example, to all work).

but then that is my 2 cents.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!