Results 1 to 6 of 6
  1. #1
    swati.jyoti is offline Member
    Join Date
    Mar 2009
    Posts
    42
    Rep Power
    0

    Question Avoiding system.exit()

    What should we do to avoid system.exit() since its not a good programming practice..

    thanks

  2. #2
    dswastik is offline Senior Member
    Join Date
    Dec 2008
    Location
    Kolkata
    Posts
    283
    Rep Power
    7

    Default

    For what purpose do you want that?

  3. #3
    swati.jyoti is offline Member
    Join Date
    Mar 2009
    Posts
    42
    Rep Power
    0

    Default remove system.exit()

    Was checking with PMD ,and thus warning came...dats y needed to remove system.exit()

  4. #4
    ne0lithic is offline Member
    Join Date
    Jul 2009
    Location
    India
    Posts
    2
    Rep Power
    0

    Default

    That depends a lot on how your program is structured.

    Could you give more details on that? What i'm saying is, if your program consists of one main function calling a bunch of others, well placed "return" statements or a simple re-organization would allow you to escape the use of System.exit()

  5. #5
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    You can create a RuntimeHook class which is implements Runnable, add it to the Runtime as a hook ,and when your program wants to make an exit, you can call it the initialization again

  6. #6
    swati.jyoti is offline Member
    Join Date
    Mar 2009
    Posts
    42
    Rep Power
    0

Similar Threads

  1. System.exit 0 or 1?
    By antgaudi in forum New To Java
    Replies: 3
    Last Post: 11-13-2008, 07:33 PM
  2. Avoiding refresh
    By java_srinivasan in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 06-25-2008, 10:01 AM
  3. System.exit() in catch block.
    By new_2_java in forum Advanced Java
    Replies: 8
    Last Post: 06-24-2008, 04:45 PM
  4. system.exit(..)
    By ramakanta.majhi in forum New To Java
    Replies: 2
    Last Post: 06-14-2008, 02:28 AM
  5. help with System.exit (1) function call
    By katie in forum Advanced Java
    Replies: 2
    Last Post: 08-06-2007, 09:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •