If i use System.exit(0) in the catch block will finally block executed

If i use System.exit(0) in the try block or catch block will finally block will be executed?
try
  System.exit(0);
catch(Exception e){
  System.exit(0);     
finally
  System.out.println("finally!");
}

gavas_java_nov26_exception wrote:
If i use System.exit(0) in the try block or catch block will finally block will be executed?
try
System.exit(0);
catch(Exception e){
System.exit(0);     
finally
System.out.println("finally!");
To tell you the truth, What does it matter? You shouldn't be doing that anyway, at least not in a well written program.
But, if you really want to find out, do as duffymo said, and try it. It'll only take a minute and save you the time (and embarressment) of asking here.

Similar Messages

  • Using System.exit(0) in executeScript

    When using System.exit(0) in executeScript within a process, it shuts down JBoss. This happens both
    in LC ES2.5 and ADEP  10.0.1.20111108.1.309370
    I would expect that System.exit(0) simply ends the script and returns control to the process. Am I
    missing something here?
    TIA,
    Alex

    gavas_java_nov26_exception wrote:
    If i use System.exit(0) in the try block or catch block will finally block will be executed?
    try
    System.exit(0);
    catch(Exception e){
    System.exit(0);     
    finally
    System.out.println("finally!");
    To tell you the truth, What does it matter? You shouldn't be doing that anyway, at least not in a well written program.
    But, if you really want to find out, do as duffymo said, and try it. It'll only take a minute and save you the time (and embarressment) of asking here.

  • How to "kill" AWT Event Queue thread without using System.exit()?

    When I run my program and the first GUI window is displayed a new thread is created - "AWT-Event Queue". When my program finishes, this thread stays alive and I think it causes some problems I have experienced lately.
    Is there any possibility to "kill" this thread without using System.exit() (I can't use it for some specific reasons)

    All threads are kept alive by the JVM session. When you use System.exit(int) you kill the current session, thus killing all threads. I'm not sure, though...
    What you could do, to make sure all threads die, is to make ever thread you start member of a thread group. When you want to exit you app, you kill all the threads in the thread group before exit.
    A small example:
    //Should be declared somewhere
    static ThreadGroup threadGroup = new ThreadGroup("My ThreadGroup");
    class MyClass extends Thread {
    super(threadGroup, "MyThread");
    Thread thread = new Thread(threadGroup, "MySecondThread");
    void exit() {
    //Deprecated, seek alternative
    threadGroup.stop();
    System.exit(0);
    }

  • Problem using System.exit()

    Hai,
    I used System.exit(1) system call in my servlet code. When this part of code is executed the whole server goes down.. i need to know if there is another smooth way of exiting code instead of System.exit().
    Thanks

    is another smooth way of exiting code instead of System.exit().System.exit() is supposed to terminate the JVM....however, your server (especially I have seen Tomcat 4.x) can hang if you call System.exit()...because there may be some active threads still running in the JVM, and server is not able to terminate them...and gets stuck.
    What is your intent? If you want to cleanly shutdown the server, then don't call System.exit(), instead, the server listens on some port for commands, connect to that port and issue a quit/exit command. For example, in tomcat looking at server.xml you could look at this element <Server port="8005" shutdown="SHUTDOWN" debug="0">. Connect to port 8005 and issue "SHUTDOWN" command to gracefully terminate the Server.
    -BJ

  • How do I exit a java program based on condition can i use system.exit

    I have java program that is called by another program that I dont have control on. My program returns a bigdecimal... but if the ordernumber is empty in my program i dont wnat to do anything.. does system.exit work in that condition... i put it int he else if ordernumber is empty condition.. but i dont think that is the right approach..

    When software module is expected to bring some result, it should bring the result, positive or negative. I think you should check what your counterpart software expects as positive or negative result. And then implement your software this way. You can use System.exit, but this call is employed usually to indicate status with the software after it's completion and not to return any resulting value.
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#exit(int)

  • Closing a JFrame without using System.exit(0)

    Hello all,
    I'm writting an application at the moment that uses a JFrame as an "about box" invoked when a menu item from another JFrame is selected . The about box is set to undecorated, and I have set up an Thread to handle an animation of the credits that move up slowly. I have also added into it code to play a sound file while the credits are running.
    I wanted to have it so that the user can just click once anywhere on the Panel area of the about box, and that would close the about box window and stop the sound.
    I can get it to stop the sound on click no problem, what I'm having issues with is closing just the about box Frame. I've used System.exit(0) but this closes the original application, which I dont want it to do. I've been looking at online example code and I've found that dispose() might work... Problem is my JFrame for the about box is initiated in the main applications JFrame under an eventListener for the menuItem 'about'. The sound file is played inside the JPanel of the about box. And the listener to close it is located in the same place ( about box JPanel ).. does anyone know how to get this frame ( initiated in main applications JFrame ) and dispose of this frame through code located in the JPanel of the about box.
    I hope this is descriptive enough for you.
    Please let me know if you have any questions about my question.
    Many thanks,
    Mark.

    It seems you are asking how to find the parent frame of a Component that you know is within a frame?
    You can getParent() of the component. If it is a frame (instanceof) - dispose, else check for the getParent()...
    If you don't want to code it yourself use SwingUtilities.getWindowAncestor(Component) to get the Window in which the panel is.
    HTH
    Mike

  • Using Numbers, can I calculate the date that will be eg 45 days ahead of a given date?

    Using Numbers, can I calculate the date that will be eg 45 days ahead of a given date?

    MWB,
    Certainly. Let's say that your given date is in B2. The date 45 days earlier can be found with:
    =B2 – 45.
    Almost seems too simple.
    Jerry

  • Hello, my name is Todd, I recently dowloaded PS CC 2014. I have used PS for decades. The crop tool will show the progress bar, then at about 25% it will totally stop. What can I do? Thanks

    Hello, my name is Todd, I recently dowloaded PS CC 2014. I have used PS for decades. The crop tool will show the progress bar, then at about 25% it will totally stop, even on VERY small 72dpi images. What can I do? Thanks!

    Double check all the settings in the crop tool, and make sure you aren't telling it to create a HUGE image as a result of your settings.

  • How to use customer exit variable in the report

    Dear All,
    i want to use a standard customer exit variable in the report properties.
    In the Bex Query Designer right hand bottom you will find two buttons "Properties" and "Task". Click on task you will get different option. Choose properties from there and then select "variable sequence tab".
    I need to add a standard variable there. How can i achieve it?
    Appreciate your early help.

    You need to add variable to corresponding charctertic then you can get that varaible for sorting the sequence....
    If 0CUST is the varaible then you need to assign it 0CUSTOMER then 0CUST will be available for the sequence.
    Edited by: shanthi bhaskar on Apr 2, 2009 5:41 PM

  • Close using system.exit()

    could anyone tell me to write a new program which has a button labelled 'close'. when click on 'close', it should terminate the addition program.
    import javabook.*;
    class addition
         public static void main(String args[])
              int a, b,c;
              MainWindow mainWindow = new MainWindow(); // creates a frame,mainwindow is in javabook package
              InputBox inputBox = new InputBox(mainWindow); // creates an inputbox, is in javabook package
              OutputBox outputBox = new OutputBox(mainWindow);// creates an outputbox;
              outputBox.setVisible(true);
              a= inputBox.getInteger("Enter an integer: ");
              b=inputBox.getInteger("Enter and integer: ");
              c= a + b;
              outputBox.printLine("C = %d\n",c);
    }

    closeButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.exit(0);
    });

  • Ever since I used an apple wireless keyboard, the onscreen keyboard will not appear

    I have been using the iPad for several years. Recently I added the apple wireless keyboard. Ever since, when I do not have the apple wireless keyboard the onscreen keyboard refuses to appear. Makes entering text difficult! Wuld be happy to learn of a solution. Thanks.

    Welcome to the Apple Support Communities
    Did you turn off Bluetooth after turning off the Apple Wireless Keyboard? Open Settings > Bluetooth and turn Bluetooth off.
    Another thing you can do is, before turning off the keyboard, select a text box on the iPad (for example, when you type an email or you type on a Safari webpage) and press Eject key on the keyboard, so the virtual keyboard will show

  • How to use user exit to complete the PR item valuation price?

    Hi Experts,
    I am working on a user exit about Purchase requisition and the description is as following:
    In standard SAP, the Purchase Requisition (PR) is an internal document to translate a pur-chasing requirement. Standard, at the moment of a PR, no supplier is known and therefore no purchase price is known.
    In standard SAP, the purchase price and price conditions are introduced in the Purchase Or-der (PO); these fields are not available in the PR. Instead, the PR contains an estimated valuation price per item, this is the historic purchasing price (standard price or moving aver-age price).   
    For the GFP project, the purchase price needs to be introduced in the PR. This is due to the fact that budget reservations are made for PRu2019s. Therefore, each PR needs to have a correct purchasing value. As budget forecasting also takes into account the tax (VAT), the PR value needs to be VAT inclusive.
    The goal of this development is to ensure that the user does not need to complete the PR item valuation price manually. Instead, this field should be filled with the item contract or info record price.
    The purpose of this development is to extract the correct purchasing price from the agree-ment / info record when applicable. Thus:
    u2022If the user does not assign a source to an item, do not overwrite the item valuation price
    u2022If the user assigns a source to an item based on an agreement, use the agreement number and item to extract the purchasing item price
    u2022If the user assigns a source to an item based on an info record, use the info record number and purchasing organisation to extract the purchasing item price
    The enhancement trigger is the assignment of a source of supply by selecting a certain pur-chasing agreement (contract) or a certain info record.
    can anyone help me on this? do you know how to know the time when the trigger of the source of supply by selecting a certain pur-chasing agreement (contract) or a certain info record happens? thanks in advance!
    Kind regards
    Dawson
    Edited by: Julius Bussche on Jul 25, 2009 7:06 AM
    "Hi" removed from subject title...

    Hi Debadatta,
    Welcome to SDN.
    Have you looked report program <b>RM07MAAU</b> (Report for Material Document Archiving)?
    Hope this will help.
    Regards,
    Ferry Lianto

  • How to use System Variable SY_ROW in the Process Instruction Category

    Hi ,
    I want to assign a value of System variable SY_ROW to a Normal Variable in the Process Instruction Category and use it in the formula. Please help me with the Syntax in the Process Instruction Category to get the System Variable: SY_ROW value into a Variable.
    Thanks,
    SV

    Hello,
    You can use these variables in formulas or, for example, to pass on certain pieces of information to a function module. How the function called by the function module behaves depends on the type of information passed on.
    SY_ROW is used to view the current Table line.
    Please look into the below link for more details on syntax :
    http://help.sap.com/saphelp_46c/helpdata/en/1a/514e38493e4774e10000009b38f889/frameset.htm
    http://help.sap.com/saphelp_470/helpdata/en/1a/514e38493e4774e10000009b38f889/frameset.htm
    Hope the information is helpful
    Regards

  • How to make a program that will ask for a name the first time the program is used and if is not the first time will not ask the name?

    I want to make a program that will ask for the ID of the testing machine the first time the program is running, then will never ask for it. I'm using Labview 6.0

    Hi
    There are a Couple of methods you can use for this.
    Method 1 -
    You can create an ini file and save a boolean Key "First Instance" as True. Now In your Program you read this Key, If it is True then you can show your ID Dialog VI.If False do not run the VI. At the Conclusion of Id Dialog you can update this registry enrty to False. So In effect you have created One time Event. In fact you can save ID as another Config entry.
    The Drawback and advantage is that such an INI file can be edited by someone moderately knowledgeable about the Program
    Method 2
    Use Unitialized Shift Register in A while Loop. Please see LV2 style Globals entry under this forum. You can read and write to this Variable and it retains the Value it last had within it.
    You can read
    this Global the Very first time and say if it true you display your ID Vi. If False you dont. When you display your ID Vi you can Update your Global Like Before.
    If you need Example Let me Know.
    Good Luck
    Mache!!
    Good Luck!
    Mache

  • Possible to use an icon other than the default when building a distribution executable for a third party customer ?

    I build stand-alone exe's for customers, and would like to know if in the "Build Distribution Kit" dialog there is an option for using a non-standard icon? If not, what else will work...? Thanks.

    1. Using windows "START" button,
    START->Programs->National Instruments CVI
    ->Utility Programs->Icon Editor.
    2. Double click the icon editor.
    Create your ICON.
    3. Save your icon by,"FILE" "SAVE AS"
    xxxxxx.ico. I suggest you save the
    icon in your program folder.
    4. Now build a stand alone executable.
    CVI will ask for "name" and "path"
    of the icon.
    5. By dragging the .exe to your desktop
    your icon will follow.
    6. When you create a distribution kit the
    icon will be placed into the kit.
    7. After the customer installs the kit
    the icon will show up in a small window
    they can drag the icon to the disk top
    or drag the .exe to the disk top at a
    later time.
    James Holmes
    Trak Microwave Tampa Fl.
    (813)884-1411 ext. 247
    jhol
    [email protected]

Maybe you are looking for