Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with SecurityException in J2ME WTK 2.5.1?  RSS feed

 
Roshni Singhania
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm trying to write my first program in J2ME, a simple midlet to display a textbox on screen. When I try to run it, I get the following Exception. Can anyone please help me with it? Is there anything I'm supposed to do with the settings/preferences? Please help! The exception message I get is -

startApp threw an Exception
java.lang.SecurityException: Application not authorized to access the restricted API
at com.sun.midp.security.SecurityToken.checkIfPermissionAllowed(+40)
at com.sun.midp.security.SecurityToken.checkIfPermissionAllowed(+7)
at com.sun.midp.midletsuite.MIDletSuiteImpl.checkIfPermissionAllowed(+8)
at com.sun.midp.midlet.MIDletState.<init>(+83)
at javax.microedition.midlet.MIDletProxy.<init>(+5)
at javax.microedition.midlet.MIDlet.<init>(+13)
at J2ME_TextBox.<init>(+4)
at J2ME_TextBox.startApp(+7)
at javax.microedition.midlet.MIDletProxy.startApp(+7)
at com.sun.midp.midlet.Scheduler.schedule(+270)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+80)
[ August 06, 2007: Message edited by: Roshni Singhania ]
 
Evan J. Goff
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're using Sun's wireless toolkit for mobile development, check this out:

http://developers.sun.com/mobility/midp/articles/wtk20/

Remember that the required mobile permissions are listed in your .jad file under the entry MIDlet-Permissions:
There is also another entry in the .jad file that list optional permissions, something like MIDlet-Permissions-Opt:
Pay VERY close attention to how you describe your permissions listed in the .jad file. Some permission entries appear just as a package name, while others reference something more specific like the name of the method called (to activate a camera on a phone to take a picture using MMAPI, for instance).
Also, check out information about Java ME protection domains and signing midlets.
 
Curse your sudden but inevitable betrayal! And this tiny ad too!
Thoughts on deprecation in Java
https://coderanch.com/t/683016/java/Deprecation-Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!