Skip to main content
gamedev.net
🔒 Locked

J2me Error

Started by isiahil Mar 28, 2006 at 10:20 PM 8 replies 2k views
Original Post
isiahil
isiahil
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)
I don't have to do nothing but live and die, everything else i choose to do- I don't know, but my dad says it alot
Alan Kemp
Alan Kemp
You have a mistake on line 17.

Alan

(Post code and maybe someone can help you. Include your .jad file.)
"There will come a time when you believe everything is finished. That will be the beginning." -Louis L'Amour
_nomad_
_nomad_
how did you know it was line 17 with the error above? i never figured it out.
isiahil
isiahil
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();  }}
I don't have to do nothing but live and die, everything else i choose to do- I don't know, but my dad says it alot
Alan Kemp
Alan Kemp
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
"There will come a time when you believe everything is finished. That will be the beginning." -Louis L'Amour
shmoove
shmoove
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
isiahil
isiahil
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.*;
I don't have to do nothing but live and die, everything else i choose to do- I don't know, but my dad says it alot
Alan Kemp
Alan Kemp
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
"There will come a time when you believe everything is finished. That will be the beginning." -Louis L'Amour
isiahil
isiahil
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.
I don't have to do nothing but live and die, everything else i choose to do- I don't know, but my dad says it alot

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.