配置都做完了,做了一个简单的hello world,可编译总是出以下的错
Running with storage root DefaultGrayPhone
Running with locale: Chinese_People's Republic of China.936
Running in the identified_third_party security domain
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.midletsuite.Installer.getInstaller(+18)
at com.sun.midp.dev.GraphicalInstaller.<init>(+367)
at com.sun.midp.dev.GraphicalInstaller.<init>(+6)
at java.lang.Class.runCustomCode(+0)
at com.sun.midp.midlet.MIDletState.createMIDlet(+34)
at com.sun.midp.midlet.Scheduler.schedule(+52)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+80)
Execution completed.
3389758 bytecodes executed
24 thread switches
1666 classes in the system (including system classes)
17593 dynamic objects allocated (522376 bytes)
1 garbage collections (0 bytes collected)
后来发现是wirless toolkit Emulator的设置问题
图中Midlet的地方,要么空着,要么填程序名称。
将WTK目录下的audiodemo源代码复制到工程所在目录下,运行正常,如下: