wood burning stoves 2.0*
The moose likes Product and Other Certifications and the fly likes System.exit()------question? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "System.exit()------question?" Watch "System.exit()------question?" New topic
Author

System.exit()------question?

China GuiLin
Greenhorn

Joined: Oct 15, 2006
Posts: 3
HI rancher;

MIDlet must not call the System.exit() method,if called,a SecurityException will be throw.

import javax.microedition.midlet.*;

public class MyMIDlet8 extends MIDlet

{
public void startApp() throws MIDletStateChangeException
{
System.out.println("Hello World");
}
public void pauseApp(){}
public void destroyApp(boolean unconditional)//throws MIDletStateChangeException
{
System.exit(0);
}
}

But this code will run without exception.why?
I am preparing for SCMAD,and get some ideas to me .
thank you~!
Eduardo Marques
Ranch Hand

Joined: Feb 19, 2005
Posts: 231
An exception is actually thrown if the device conforms to the MIDP specs.

However since this happens in the destroyApp() methods, maybe the WTK (or the device you're using) ignores it. Note that you don't need and should not use System.exit(0), particularly in the destroyApp() method. destroyApp() is called when the MIDlet is being destroyed ...

If you're interested in studying for SCMAD take a look at the http://j2mecertificate.com exam simulator, including mock questions you
can have a go at. Other resources are listed in http://faq.javaranch.com/view?ScmadLinks

Regards,
[ November 09, 2006: Message edited by: Eduardo Marques ]

Eduardo Marques
Get ready for your SCMAD certification at J2MECertificate.com - See what all the buzz is about ...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: System.exit()------question?
 
Similar Threads
Diffrent screens with commandlistener
Nokia Emulator shuts itself down
MIDlet lifecycle
target release conflicts with default source
UnsatisfiedLinkError, zayit, libzayit.so, wtk, linux