Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with SecurityException in J2ME WTK 2.5.1?

 
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic