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 J2ME code

 
dila peerbux
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I am developing an application using NETBEANS IDE 5.5.I have a main class and from the main class i have created an instance of a class "VoiceRecorder"and the code is as such:
if (command == Record) {
VoiceRecorder v1= new VoiceRecorder();
v1.record();


When i run the application i obtain the following error:

java.lang.SecurityException: Application not authorized to access the restricted API
at com.sun.midp.security.SecurityToken.checkIfPermissionAllowed(SecurityToken.java:170)
at com.sun.midp.security.SecurityToken.checkIfPermissionAllowed(SecurityToken.java:145)
at com.sun.midp.midletsuite.MIDletSuiteImpl.checkIfPermissionAllowed(MIDletSuiteImpl.java:281)
at com.sun.midp.midlet.MIDletState.<init>(MIDletState.java:301)
at javax.microedition.midlet.MIDletProxy.<init>(MIDletProxy.java:33)
at javax.microedition.midlet.MIDlet.<init>(MIDlet.java:70)
at splashscreenexample.MySplashScreenMidlet.<init>(MySplashScreenMidlet.java:30)
at splashscreenexample.VoiceRecorder.<init>(MySplashScreenMidlet.java:705)
at splashscreenexample.MySplashScreenMidlet.commandAction(MySplashScreenMidlet.java:112)
at javax.microedition.lcdui.Display$DisplayAccessor.commandAction(Display.java:1992)
at javax.microedition.lcdui.Display$DisplayManagerImpl.commandAction(Display.java:2822)
at com.sun.midp.lcdui.DefaultEventHandler.commandEvent(DefaultEventHandler.java:303)
at com.sun.midp.lcdui.AutomatedEventHandler.commandEvent(AutomatedEventHandler.java:670)
at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(DefaultEventHandler.java:658)


Can anyone please advice me on what's wrong with my code?
Thank you all in advance.
 
Nicholas Jordan
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am guessing, there are some api's in many development platforms that will not run unless some security certificates have been obtained from the vendor. This is what you stack trace looks like to me. There should be an emulator - the emulators let one do development without obtaining certs.
 
Rashid Mayes
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am guessing (ie. stacktrace available) that you are seeing this error in a emulator. Try changing the domain of you applications to trusted or maximum in your emulator settings. Also check your MF and Jad to make certain you are indicating the permissions you need for your application to function correctly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic