System.exit doesnt work on Sun OS 5.7 ??

Hi, I have encountered a kind of wierd problem. I have a small application that uses System.exit when the user wants to shut down the application.
That works fine in Windows but in Sun OS 5.7 the application just freeze.
Im using java version:
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
Would be greatful if someone could help me.
This code is an small example of my application.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class ExitTest extends JFrame implements ActionListener {
JButton jButton1 = new JButton();
public ExitTest() {
try {
jbInit();
catch(Exception e) {
e.printStackTrace();
public static void main(String[] args) {
new ExitTest().setVisible(true);
private void jbInit() throws Exception {
jButton1.setText("Exit");
jButton1.addActionListener(this);
addWindowListener(this);
this.getContentPane().add(jButton1, BorderLayout.SOUTH);
public void actionPerformed(ActionEvent e) {
this.setVisible(false);
System.out.println("Exiting");
try {
System.exit(0);
} catch(SecurityException ex) {
ex.printStackTrace();
---------------------------------------------------------------------------------------------------------

Hmm, sorry about that, my misstake, that line is still there from an erlier attempt to use windowlisteners instead ... that line should not be there ...

Similar Messages

  • Why won't System.exit(0)  work?

    does System.exit(0); work with an event handler?
    I'm making a quit menu button, and I want my program to quit when it is clicked...unfortunately, System.exit(0); is not working...can soemone please help?
    thanks!

    here's all mmy code......i'm really at a loss...i can't figure anything out......
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    import java.util.*;
    public class SafetyMapView extends JFrame {
         // These are the tiles and buttons
         private JPanel               tiles;
         private JButton[]          buttons;
         private JCheckBox           editWallsButton;
         private JCheckBox           selectExitsButton;
         private JButton           computePlanButton;
         private JCheckBox           showDistancesButton;
         private JButton           resetButton;
         private JMenuBar          theMenuBar;
         private JMenu               fileM;
         private JMenuItem          openM,saveM,quitM;
         private JFileChooser      showIt;
         public void setJMenuBar(JMenuBar aMenuBar){theMenuBar=aMenuBar;}
         public JButton getFloorTileButton(int i) { return buttons; }
         public JPanel getTilePanel() { return tiles; }
         public JCheckBox getEditWallsButton() { return editWallsButton; }
         public JCheckBox getSelectExitsButton() { return selectExitsButton; }
         public JButton getComputePlanButton() { return computePlanButton; }
         public JCheckBox getShowDistancesButton() { return showDistancesButton; }
         public JButton getResetButton() { return resetButton; }
         public JFileChooser getJFileChooser() { return showIt; }
         public JMenuItem getOpen() { return openM;}
         public JMenuItem getSave() { return saveM;}
         public JMenuItem getQuit() { return quitM;}
         // This constructor builds the panel
         public SafetyMapView(String title, FloorPlan floorPlan) { 
              super(title);
              // Create the panel with the floor tiles on it      
              createFloorPlanPanel(floorPlan);
              // Layout the rest of the window's components
    setupComponents();
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setSize(600, 500);
    setVisible(true);
    // Create the panel to contain the buttons that display the floor plan
    private void createFloorPlanPanel(FloorPlan floorPlan) {
         // Setup the panel with the buttons
    buttons = new JButton[floorPlan.size()*floorPlan.size()];
    tiles = new JPanel();
    tiles.setLayout(new GridLayout(floorPlan.size(),floorPlan.size()));
              // Add the buttons to the tile panel
    for (int r=0; r<floorPlan.size(); r++) {
         for (int c=0; c<floorPlan.size(); c++) {
              int i = r * floorPlan.size() + c;
              buttons[i] = new JButton();
              buttons[i].setBorder(BorderFactory.createLineBorder(Color.lightGray));
              buttons[i].setBackground(Color.white);
              tiles.add(buttons[i]);
         public void setOpenHandler(java.awt.event.ActionListener x){
         /*public void setSaveHandler(java.awt.event.ActionListener x){
                   int option = 0;
                   java.io.File sel = null;
                   java.io.File[] files = null;
                   String filename = null;
                   javax.swing.JFileChooser chsr = new javax.swing.JFileChooser();
                   option = chsr.showSaveDialog(null);
                   switch (option)
                   case javax.swing.JFileChooser.APPROVE_OPTION :
                   //do something
                        a.dispose();
                        break;
                   case javax.swing.JFileChooser.CANCEL_OPTION :
                   sel = null;
                   break;
                   case javax.swing.JFileChooser.ERROR :
                   sel = null;
                   break;
                   default :
                   sel = null;
                   break;
                   chsr.setEnabled(false);
                   //do something
                   return;
                   //DO something...//
    // Here we add all the components to the window accordingly
    private void setupComponents() {
         // Layout the components using a gridbag
    GridBagLayout layout = new GridBagLayout();
    GridBagConstraints layoutConstraints = new GridBagConstraints();
    getContentPane().setLayout(layout);
    // Add the tiles
    layoutConstraints.gridx = 0; layoutConstraints.gridy = 1;
    layoutConstraints.gridwidth = 1; layoutConstraints.gridheight = 7;
    layoutConstraints.fill = GridBagConstraints.BOTH;
    layoutConstraints.insets = new Insets(2, 2, 2, 2);
    layoutConstraints.anchor = GridBagConstraints.NORTHWEST;
    layoutConstraints.weightx = 1.0; layoutConstraints.weighty = 1.0;
    layout.setConstraints(tiles, layoutConstraints);
    getContentPane().add(tiles);
    JMenuBar myMenuBar = new JMenuBar();
    layoutConstraints.gridx = 0; layoutConstraints.gridy = 0;
    layoutConstraints.gridwidth = layoutConstraints.gridheight = 1;
    layoutConstraints.fill=GridBagConstraints.NONE;
    layoutConstraints.insets = new Insets(2, 2, 2, 2);
    layoutConstraints.anchor = GridBagConstraints.NORTHWEST;
    layoutConstraints.weightx = 0.0; layoutConstraints.weighty = 0.0;
    layout.setConstraints(myMenuBar, layoutConstraints);      
              JMenu fileMenu = new JMenu("File");
              myMenuBar.add(fileMenu);
              fileMenu.setMnemonic('F');
              JMenuItem openM = new JMenuItem("Open Floor Plan");
              fileMenu.add(openM);
              openM.setMnemonic ('O');
              JMenuItem saveM = new JMenuItem("Save Floor Plan");
              fileMenu.add(saveM);
              saveM.setMnemonic ('S');
              JMenuItem quitM = new JMenuItem("Quit");
              fileMenu.add(quitM);
              quitM.setMnemonic ('Q');
              getContentPane().add(myMenuBar);
    public static void main(String args[]){
         //try{
         new SafetyMapView("Fire Safety Routes", FloorPlan.example1());
         //catch(java.io.FileNotFoundException e){
         //     e.printStackTrace();
    I cut out the parts where all the other buttons are being added to the layout cuz it was really relaly long....

  • EXIT doesnt work

    Exit butto at playbar doesnt work? Why....

    Try looking at the link below:
    Click here to view
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • Finally and System.exit()-Will work togother?

    Does finally block execute if we call System.exit() inside a try block?
    try{
    if(condition)System.exit(0);
    finally{
    System.out.println("Inside finally");
    If condition is true, will finally execute?
    When i tried it on jdk1.3, it's not executed.

    I'm pretty sure the finally{} block will never be executed. When calling System.exit(), it tells the application to terminate immediately. Here's something you could try, if you have code that needs to run if there's been an exception or not. Sorry for the horrible code conventions.
    boolean sysExit = false;
    try{
    if(condition){
    sysExit = true;
    catch(Exception e){
    //Do whatever.
    finally{
    //Do finally stuff
    if(sysExit) System.exit(status);
    }

  • Lenovo System Update doesnt work under Winows 8

    Hi,
    I formated HD and installed Win8 on my SL500 (2746). I installed the newer version of Lenovo Update (5.02) but it detected Activie Protection System only. I read lenovo solution about it and i installed framework 3.5 not helped, Lenovo also wrote that it happend when proeviously it was ver 4.00 installed but i formated my disk before i installed SU.
    I also can't installed hotkey manualy from site:
    http://support.lenovo.com/en_US/downloads/detail.page?DocID=DS029026
    I got message that i have wrong system.
    Could You hel me what i should to do more to fix it?
    Best Regards,
    Martin

    hi bigesta,
    Welcome to Lenovo Community Forums!
    Have you tried an external keyboard and see if that works?
    Try doing a power drain
       Remove the Battery and AC adapter,
             hold the power button down for at least 15 sec.
    Plug in the AC adapter only and try turning it ON, As soon as you press the Power ON start hitting F2 to reach the BIOS set up.
         Then press F9 then Enter, then F10 And press Enter
    See if That will help
    Let me know your findings
    Solid Cruver,
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.
    Follow @LenovoForums on Twitter!

  • Keyboard and system boices doesnt work

    I can play a music , make skype call but voices of keyboard and other system voices are disfunctional inven if they are turned on in settings. Can you help me?

    Have you got notifications muted ? Only notifications (including games) get muted, so the iPod and Videos apps, and headphones, still get sound.
    Depending on what you've got Settings > General > Use Side Switch To set to (mute or rotation lock), then you can mute notifications by the switch on the right hand side of the iPad, or via the taskbar : double-click the home button; slide from the left; and it's the icon far left; press home again to exit the taskbar. The function that isn't on the side switch is set via the taskbar instead : http://support.apple.com/kb/HT4085

  • Helix gen1 system update doesnt work

    hi there, when i try to update my helix (i7 8gb 256ssd) with the system update i get an error at 17% (no required packages found)? i searched the internet for this, and i found it happening to many other lenovo notebooks too; is there any fix for the helix? best regards 

    What is the model type of your machine? What operating system are you running?Locate C:\programdata\Lenovo\systemupdate\logs\tvsu_*timestamp*.log Upload the run log to a file sharing utility similar to www.dropbox.com and post the upload link here. Note: \programdata is a hidden folder. Control panel>folder options>viewPunch "show hidden files, folders and drives"

  • Apple system preferences doesnt work

    The Apple Preferences will not open.  It has opened in the past.  I want to make some changes to my Mac G4.

    Run one of the Maintenance utilities as a first step.
    http://smokingapples.com/software/reviews/7-tools-to-keep-your-mac-healthy/
    http://mac360.com/2008/07/the_top_7_free_utilities_to_maintain_a_mac/

  • Exit from a Frame without resorting to System.exit()

    This is driving me nuts.
    I've got a really simple problem, actually... I've got a Frame and I'm trying to get rid of it so my application will exit.
    Though using System.exit() seems to be the most common way to get an application to exit, I'd prefer to avoid going that route. My program uses multiple threads, and I want to give them all a chance to exit gracefully before the application exits, as opposed to terminating them all quite suddenly. All the threads monitor a boolean value, "exiting", and terminate, after some cleanup, when the variable is set. Using join() on all the threads before using System.exit() would work, except any number of threads may be created by the program, and not all of them will be accessible by the function doing the exiting!
    If I simply omit the call to System.exit(), and remove the Frame with dispose(), the threads all shut down properly, and the program appears to have exited, except the command prompt doesn't reappear until I hit Ctrl-C.
    So I looked up the docs for the dispose() method. It was slightly different than I remembered... Obviously, that method is not the way to shut down a Frame. What is?

    So I looked up the docs for the dispose() method. It
    was slightly different than I remembered...
    Obviously, that method is not the way to shut down a
    Frame. What is?The problem is that once you use some GUI, a pool of AWT threads is created and they are not shut down, not even if there is no more GUI visible.
    Look at these other threads for some explanation on this behaviour an workarounds:
    http://forum.java.sun.com/thread.jspa?forumID=5&threadID=10901
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=122569

  • Copied webtemplate doesnt work

    Hi
    I have copied default webtemplate 0ANALYSIS_PATTERN  to ZANALYSIS_PATTERN. I have made ZANALYSIS_PATTERN as my default web template in the RSCUSTV27 and restarted J2EE sever from SMICM . but still  I can't see the changes being reflected in the web report after I made the change.I still see that the default template 0ANALYSIS_PATTERN is being used.
    how ever it works in the DEV system and when i transported to QA system it doesnt work . does anyone have any solutions. or suggestions.
    we are currently on SAP BW -701 level 8 ; SAP BI Cont- 704 level 8.
    Thanks

    Hi,
    Please correct the supportdesk tool RED signal and restart the system it should resolved your issue.
    This issue is may be related to user mapping to down properly with portal.
    Thanks,
    Venkat

  • Hello! My iMac frozed and I had to switch the electricty supply off and on in order to start again the system, with the problem that the screen looks wierd, I tried to calibrate it... doesnt works any suggestion?

    hello! My iMac frozed and I had to switch the electricty supply off and on in order to start again the system, with the problem that the screen looks wierd, I tried to calibrate it... doesnt works any suggestion?

    Dear Paul, thank you very much for your time and answer, I followed those steps, somehow it helped the performance of my Imac, is faster now, but the screen issue about the very High contrast colours is still there. Since I am a photographer I am very depending on the screen calibration. I am worried that I came to damage the video card when I shut down the computer from the swicth when It was frozed.

  • When i plug my ipod shuffle 4th generation in a box pops up and says the right files for this ipod isnt on the system?? sooo i re downloaded itunes and it still doesnt work soo i deleted it all and eredownloaded itunes all up to date and it still doesnt !

    when i plug my ipod shuffle 4th generation in a box pops up and says the right files for this ipod isnt on the system?? sooo i re downloaded itunes and it still doesnt work soo i deleted it all and eredownloaded itunes all up to date and it still doesnt ! any help please

    What was the exact error message you received?  When you removed and re-installed iTunes, did you use the precise instructions in this Apple support document to walk you through the process?
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP
    B-rock

  • My analogue 5.1 Sound System doesnt work on Soundblaster live 24-bit soundcard

    <SPAN>Hello!<SPAN>
    <SPAN>I have a Wavemaster<SPAN>MX-5 5. Surround Sound System with Subwoofer (=<SPAN><SPAN>http://www.hms-media.de/EN/?Tab=Products&Group=3&Product=7<SPAN>) and it doesnt work on the Soundblaster li've 24 bit.<SPAN>
    <SPAN>I have installed all the drivers properly and the card seems to be working ok.... <SPAN>
    <SPAN>But i have a <SPAN>analogue<SPAN> Surround Sound System what must i do to get this working?<SPAN>
    <SPAN>Is it possible to add a converter that can transform; digital to analogue signal? Or can i change some settings >?<SPAN>
    <SPAN>Plzzzzz Help me !!! I love my music :smileyindifferent:<SPAN>
    <SPAN>Greetz Axz:.<SPAN>

    > i have surround sound only when i play *.acc files but with *.mp3 files it doesnt work
    You'll have to enable surround matrix decoding for stereo material. There are several analog encoding standards (Dolby Surround, Dolby ProLogic, Dolby ProLogic II) but Creative's driver doesn't have an official decoder for any of them Instead, they provide their home-grown decoders and call them CMSS or DTS NEO:6. I can only assume they want to dodge Dolby's license payments by not supporting familiar standards. Anyway, you will find the CMSS modes in the driver or, in case of NEO, in their mediasource player. NEO - because it's in a player and not in the driver - is out of reach for other players such as WinAmp or multimedia and TV software.
    If you plan to listen to music only, the Creative CMSS matrix decoders ("upmix") might satisfy you. If you plan to watch movies or watch TV, you will find that, with exception of DTS NEO:6, they are not good at all. A ProLogic II decoder sounds much better. If you are lucky, your player has a software ProLogic decoder. For example, WinDVD has one. Unfortunately, in that case the soundcard's high tech DSP - which you payed $$$ for - will not be used at all.
    An alternati've solution for non-gamers (for movies and music) is to install the kx driver from the kx project at http://kxproject.lugosoft.com/index.php?language=en
    For music, this driver - strangely enough - not only sounds better than Creative's own player, it is also far more configurable. For example, if your center speaker is from a differerent brand than the main speakers, you can put an equalizer before it. Or you can redirect bass from small speakers to larger speakers and not just to the subwoofer, as is the case with Creative's drivers. The options are endless. You can even create totally different configurations for different situations (movie/music/...) and switch on the fly. Other benefits: the driver is very small and very fast, everything happens instantly. However, its user interface is weird and the project lacks documentation. You will need determination on the first day. Afterwards, you will be able to configure your music/movie system to sound far better than with Creative's driver and customize details that simply can not be customized with the official driver. And the best thing: everything will run inside the card's DSP and the computer's CPU is free to do other stuff. Btw, the link above leads you to the last official release. If you read their forum, you will find a more recent beta release from this year.Message Edited by mirko on 0-2-2005 0:22 PM

  • I started the OS system from a backup hard drive. Now My Adobe products doesnt work. "the licensing does not work for this product" Error code 150:30. Help me please!!

    I started the OS system from a backup hard drive. Now My Adobe products doesnt work. "the licensing does not work for this product" Error code 150:30. Help me please!!

    Reinstall the software properly. migration/ backups do not work due to the specific requirements of the activation system.
    Mylenium

  • I put guided access on and stretched the whole thing put a passcode, and now i cant exit it because it doesnt work and says that you need to triple tap the home button, i cant put the passcode as it is disabled

    i put guided access on and stretched the whole thing put a passcode, and now i cant exit it because it doesnt work and says that you need to triple tap the home button, i cant put the passcode as it is disabled

    If you can't enter the passcode then you have to place the iPod in recovery mode and then restore the iPod via iTunes. For ecovery mode see:
    iPhone and iPod touch: Unable to update or restore
    Note that this requires using the sleep/wake button.  If you are not successful then there is nothing else that I know you can do.

Maybe you are looking for

  • Key Figure Calculation in Query

    Gurus, How do i calcculate below  in query  basically i have 3 KF as dates below and want a CKF or formula variable which calculates A - (IF B Not Empty then take B  or else take C.) Z = A - if (B != " '', B, C) A = Key Figure B = Key Figure C = Key

  • How can i add a new 53 rd week to calendar

    Hi All, we have requirment i need to add a new week to fiscal year 2011 for septemebr,2011 Please let me know how can i add a new week to this month, Thanks & regards, Chand

  • How can i tell how much hard drive space my website is taking up on my computer?

    I have a website that i build through iweb and publish via mobile me.  i have about 200 podcasts on the site, and I am trying to figure out how much hard drive space this is taking up on my computer.  these files are not in itunes, and i'm not concer

  • How can i control concurrent programs?

    Hi When ruinning GL & OPM concurrent programs, de-grades server peformance. How can i control it? I want to restrict the user not to submit or does not run during office-hours. How can it be achieved? Regards Ariz

  • OSB : dynamic URL change

    hi my requirement is as following: PS hits BS. BS has URL-1. So PS hits URL-1 location. Now, if URL-1 is not working, it should automatically retry to URL-2. If I put both URL-1 and URL-2 as business service BS URLs, then URL-1 and URL-2 are hit rand