🔒 Locked
J2me Error
Advertisement
Original Post
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)
Where is the .jad file located? I have the .jar but cant find the .jad.
Here is the code:
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(); }}
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
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
shmoove
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
Alan
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement